@karmaniverous/jeeves
    Preparing search index...

    Class ComponentWriter

    Orchestrates managed content writing for a single Jeeves component.

    Created via createComponentWriter. Manages a timer that fires at the component's prime-interval, calling generateToolsContent() and refreshPlatformContent() on each cycle.

    Index

    Constructors

    • Internal

      Parameters

      • component: {
            configFileName: string;
            configSchema: ZodType<
                unknown,
                unknown,
                $ZodTypeInternals<unknown, unknown>,
            >;
            customCliCommands?: $InferOuterFunctionType<
                ZodTuple<
                    readonly [ZodCustom<Command<[], {}, {}>, Command<[], {}, {}>>],
                    null,
                >,
                ZodVoid,
            >;
            customMerge?: $InferOuterFunctionType<
                ZodTuple<
                    readonly [
                        ZodRecord<ZodString, ZodUnknown>,
                        ZodRecord<ZodString, ZodUnknown>,
                    ],
                    null,
                >,
                ZodRecord<ZodString, ZodUnknown>,
            >;
            customPluginTools?: $InferOuterFunctionType<
                ZodTuple<readonly [ZodCustom<PluginApi, PluginApi>], null>,
                ZodArray<ZodUnknown>,
            >;
            defaultPort: number;
            dependencies?: { hard: string[]; soft: string[] };
            generateToolsContent: $InferOuterFunctionType<
                ZodTuple<readonly [], null>,
                ZodString,
            >;
            initTemplate: $InferOuterFunctionType<
                ZodTuple<readonly [], null>,
                ZodRecord<ZodString, ZodUnknown>,
            >;
            name: string;
            onConfigApply?: $InferOuterFunctionType<
                ZodTuple<readonly [ZodRecord<ZodString, ZodUnknown>], null>,
                ZodPromise<ZodVoid>,
            >;
            pluginPackage: string;
            refreshIntervalSeconds: number;
            run: $InferOuterFunctionType<
                ZodTuple<readonly [ZodString], null>,
                ZodPromise<ZodVoid>,
            >;
            sectionId: string;
            serviceName?: string;
            servicePackage: string;
            startCommand: $InferOuterFunctionType<
                ZodTuple<readonly [ZodString], null>,
                ZodArray<ZodString>,
            >;
            version: string;
        }
        • configFileName: string

          Config file name (e.g., 'jeeves-watcher.config.json').

        • configSchema: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>

          Zod schema for validating config files.

        • OptionalcustomCliCommands?: $InferOuterFunctionType<
              ZodTuple<
                  readonly [ZodCustom<Command<[], {}, {}>, Command<[], {}, {}>>],
                  null,
              >,
              ZodVoid,
          >

          Extension point: add custom CLI commands to the service CLI.

        • OptionalcustomMerge?: $InferOuterFunctionType<
              ZodTuple<
                  readonly [
                      ZodRecord<ZodString, ZodUnknown>,
                      ZodRecord<ZodString, ZodUnknown>,
                  ],
                  null,
              >,
              ZodRecord<ZodString, ZodUnknown>,
          >

          Custom merge function for config apply. Receives the existing config and the patch, returns the merged result. Optional — if omitted, the default deep-merge (object-recursive, array-replacing) is used.

          Use this to implement domain-specific merge strategies such as name-based array merging for inference rules.

        • OptionalcustomPluginTools?: $InferOuterFunctionType<
              ZodTuple<readonly [ZodCustom<PluginApi, PluginApi>], null>,
              ZodArray<ZodUnknown>,
          >

          Extension point: return additional plugin tool descriptors.

        • defaultPort: number

          Default port for the service's HTTP API.

        • Optionaldependencies?: { hard: string[]; soft: string[] }

          Component dependencies for HEARTBEAT alert suppression.

          • hard: string[]

            Components that must be healthy for this component to function.

          • soft: string[]

            Components that improve behavior but are not strictly required.

        • generateToolsContent: $InferOuterFunctionType<ZodTuple<readonly [], null>, ZodString>

          Produce the component's TOOLS.md section content.

        • initTemplate: $InferOuterFunctionType<
              ZodTuple<readonly [], null>,
              ZodRecord<ZodString, ZodUnknown>,
          >

          Returns a default config object for init.

        • name: string

          Component name (e.g., 'watcher', 'runner', 'server', 'meta').

        • OptionalonConfigApply?: $InferOuterFunctionType<
              ZodTuple<readonly [ZodRecord<ZodString, ZodUnknown>], null>,
              ZodPromise<ZodVoid>,
          >

          Service-side callback after config apply. Receives the merged, validated config (not the raw patch). Optional — if omitted, write-only (service picks up changes on restart).

        • pluginPackage: string

          npm package name for the plugin.

        • refreshIntervalSeconds: number

          Refresh interval in seconds (must be a prime number).

        • run: $InferOuterFunctionType<
              ZodTuple<readonly [ZodString], null>,
              ZodPromise<ZodVoid>,
          >

          In-process service entry point for the CLI start command.

        • sectionId: string

          TOOLS.md section name (e.g., 'Watcher').

        • OptionalserviceName?: string

          System service name. Defaults to jeeves-${name} when not provided.

        • servicePackage: string

          npm package name for the service.

        • startCommand: $InferOuterFunctionType<
              ZodTuple<readonly [ZodString], null>,
              ZodArray<ZodString>,
          >

          Returns command + args for launching the service process. Consumed by service install.

        • version: string

          Component version (from package.json).

      • Optionaloptions: ComponentWriterOptions

      Returns ComponentWriter

    Accessors

    • get isRunning(): boolean

      Whether the writer timer is currently running or pending its first cycle.

      Returns boolean

    Methods

    • Start the writer timer.

      Returns void

      Delays the first cycle by a random jitter (0 to one full interval) to spread initial writes across all component plugins and reduce EPERM contention on startup.