@stigmer/cli 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +42 -0
- package/auth/auth0.d.ts +19 -0
- package/auth/auth0.d.ts.map +1 -0
- package/auth/auth0.js +39 -0
- package/auth/auth0.js.map +1 -0
- package/auth/callback-server.d.ts +18 -0
- package/auth/callback-server.d.ts.map +1 -0
- package/auth/callback-server.js +77 -0
- package/auth/callback-server.js.map +1 -0
- package/auth/index.d.ts +5 -0
- package/auth/index.d.ts.map +1 -0
- package/auth/index.js +6 -0
- package/auth/index.js.map +1 -0
- package/auth/login.d.ts +2 -0
- package/auth/login.d.ts.map +1 -0
- package/auth/login.js +56 -0
- package/auth/login.js.map +1 -0
- package/auth/pages.d.ts +7 -0
- package/auth/pages.d.ts.map +1 -0
- package/auth/pages.js +21 -0
- package/auth/pages.js.map +1 -0
- package/auth/pkce.d.ts +7 -0
- package/auth/pkce.d.ts.map +1 -0
- package/auth/pkce.js +22 -0
- package/auth/pkce.js.map +1 -0
- package/auth/token.d.ts +33 -0
- package/auth/token.d.ts.map +1 -0
- package/auth/token.js +111 -0
- package/auth/token.js.map +1 -0
- package/backend.d.ts +5 -0
- package/backend.d.ts.map +1 -0
- package/backend.js +14 -0
- package/backend.js.map +1 -0
- package/cli/stigmer.d.ts +3 -0
- package/cli/stigmer.d.ts.map +1 -0
- package/cli/stigmer.js +14 -0
- package/cli/stigmer.js.map +1 -0
- package/client/client.d.ts +25 -0
- package/client/client.d.ts.map +1 -0
- package/client/client.js +55 -0
- package/client/client.js.map +1 -0
- package/client/index.d.ts +2 -0
- package/client/index.d.ts.map +1 -0
- package/client/index.js +3 -0
- package/client/index.js.map +1 -0
- package/commands/agent-exec-flags.d.ts +30 -0
- package/commands/agent-exec-flags.d.ts.map +1 -0
- package/commands/agent-exec-flags.js +52 -0
- package/commands/agent-exec-flags.js.map +1 -0
- package/commands/apikey/duration.d.ts +2 -0
- package/commands/apikey/duration.d.ts.map +1 -0
- package/commands/apikey/duration.js +30 -0
- package/commands/apikey/duration.js.map +1 -0
- package/commands/apikey/index.d.ts +3 -0
- package/commands/apikey/index.d.ts.map +1 -0
- package/commands/apikey/index.js +118 -0
- package/commands/apikey/index.js.map +1 -0
- package/commands/apply.d.ts +3 -0
- package/commands/apply.d.ts.map +1 -0
- package/commands/apply.js +155 -0
- package/commands/apply.js.map +1 -0
- package/commands/auth/index.d.ts +3 -0
- package/commands/auth/index.d.ts.map +1 -0
- package/commands/auth/index.js +76 -0
- package/commands/auth/index.js.map +1 -0
- package/commands/completion.d.ts +3 -0
- package/commands/completion.d.ts.map +1 -0
- package/commands/completion.js +82 -0
- package/commands/completion.js.map +1 -0
- package/commands/config/backend.d.ts +3 -0
- package/commands/config/backend.d.ts.map +1 -0
- package/commands/config/backend.js +49 -0
- package/commands/config/backend.js.map +1 -0
- package/commands/config/context.d.ts +3 -0
- package/commands/config/context.d.ts.map +1 -0
- package/commands/config/context.js +23 -0
- package/commands/config/context.js.map +1 -0
- package/commands/config/index.d.ts +3 -0
- package/commands/config/index.d.ts.map +1 -0
- package/commands/config/index.js +13 -0
- package/commands/config/index.js.map +1 -0
- package/commands/config/kv.d.ts +3 -0
- package/commands/config/kv.d.ts.map +1 -0
- package/commands/config/kv.js +39 -0
- package/commands/config/kv.js.map +1 -0
- package/commands/connect.d.ts +3 -0
- package/commands/connect.d.ts.map +1 -0
- package/commands/connect.js +56 -0
- package/commands/connect.js.map +1 -0
- package/commands/delete.d.ts +3 -0
- package/commands/delete.d.ts.map +1 -0
- package/commands/delete.js +41 -0
- package/commands/delete.js.map +1 -0
- package/commands/diff.d.ts +3 -0
- package/commands/diff.d.ts.map +1 -0
- package/commands/diff.js +87 -0
- package/commands/diff.js.map +1 -0
- package/commands/down.d.ts +3 -0
- package/commands/down.d.ts.map +1 -0
- package/commands/down.js +23 -0
- package/commands/down.js.map +1 -0
- package/commands/download.d.ts +3 -0
- package/commands/download.d.ts.map +1 -0
- package/commands/download.js +46 -0
- package/commands/download.js.map +1 -0
- package/commands/draft.d.ts +3 -0
- package/commands/draft.d.ts.map +1 -0
- package/commands/draft.js +97 -0
- package/commands/draft.js.map +1 -0
- package/commands/execution/approve.d.ts +3 -0
- package/commands/execution/approve.d.ts.map +1 -0
- package/commands/execution/approve.js +60 -0
- package/commands/execution/approve.js.map +1 -0
- package/commands/execution/control.d.ts +3 -0
- package/commands/execution/control.d.ts.map +1 -0
- package/commands/execution/control.js +57 -0
- package/commands/execution/control.js.map +1 -0
- package/commands/execution/index.d.ts +3 -0
- package/commands/execution/index.d.ts.map +1 -0
- package/commands/execution/index.js +21 -0
- package/commands/execution/index.js.map +1 -0
- package/commands/execution/logs.d.ts +3 -0
- package/commands/execution/logs.d.ts.map +1 -0
- package/commands/execution/logs.js +34 -0
- package/commands/execution/logs.js.map +1 -0
- package/commands/execution/trace.d.ts +3 -0
- package/commands/execution/trace.d.ts.map +1 -0
- package/commands/execution/trace.js +24 -0
- package/commands/execution/trace.js.map +1 -0
- package/commands/get.d.ts +3 -0
- package/commands/get.d.ts.map +1 -0
- package/commands/get.js +81 -0
- package/commands/get.js.map +1 -0
- package/commands/internal-daemon.d.ts +3 -0
- package/commands/internal-daemon.d.ts.map +1 -0
- package/commands/internal-daemon.js +22 -0
- package/commands/internal-daemon.js.map +1 -0
- package/commands/list.d.ts +3 -0
- package/commands/list.d.ts.map +1 -0
- package/commands/list.js +117 -0
- package/commands/list.js.map +1 -0
- package/commands/logs.d.ts +3 -0
- package/commands/logs.d.ts.map +1 -0
- package/commands/logs.js +59 -0
- package/commands/logs.js.map +1 -0
- package/commands/mcp-server.d.ts +22 -0
- package/commands/mcp-server.d.ts.map +1 -0
- package/commands/mcp-server.js +104 -0
- package/commands/mcp-server.js.map +1 -0
- package/commands/push.d.ts +3 -0
- package/commands/push.d.ts.map +1 -0
- package/commands/push.js +150 -0
- package/commands/push.js.map +1 -0
- package/commands/reset.d.ts +3 -0
- package/commands/reset.d.ts.map +1 -0
- package/commands/reset.js +45 -0
- package/commands/reset.js.map +1 -0
- package/commands/resume.d.ts +3 -0
- package/commands/resume.d.ts.map +1 -0
- package/commands/resume.js +87 -0
- package/commands/resume.js.map +1 -0
- package/commands/run.d.ts +3 -0
- package/commands/run.d.ts.map +1 -0
- package/commands/run.js +193 -0
- package/commands/run.js.map +1 -0
- package/commands/search.d.ts +3 -0
- package/commands/search.d.ts.map +1 -0
- package/commands/search.js +73 -0
- package/commands/search.js.map +1 -0
- package/commands/seedpack.d.ts +3 -0
- package/commands/seedpack.d.ts.map +1 -0
- package/commands/seedpack.js +76 -0
- package/commands/seedpack.js.map +1 -0
- package/commands/setup.d.ts +3 -0
- package/commands/setup.d.ts.map +1 -0
- package/commands/setup.js +57 -0
- package/commands/setup.js.map +1 -0
- package/commands/shared.d.ts +15 -0
- package/commands/shared.d.ts.map +1 -0
- package/commands/shared.js +34 -0
- package/commands/shared.js.map +1 -0
- package/commands/status.d.ts +3 -0
- package/commands/status.d.ts.map +1 -0
- package/commands/status.js +18 -0
- package/commands/status.js.map +1 -0
- package/commands/tag.d.ts +3 -0
- package/commands/tag.d.ts.map +1 -0
- package/commands/tag.js +24 -0
- package/commands/tag.js.map +1 -0
- package/commands/up.d.ts +3 -0
- package/commands/up.d.ts.map +1 -0
- package/commands/up.js +39 -0
- package/commands/up.js.map +1 -0
- package/commands/usage.d.ts +3 -0
- package/commands/usage.d.ts.map +1 -0
- package/commands/usage.js +56 -0
- package/commands/usage.js.map +1 -0
- package/commands/validate.d.ts +3 -0
- package/commands/validate.d.ts.map +1 -0
- package/commands/validate.js +64 -0
- package/commands/validate.js.map +1 -0
- package/commands/version.d.ts +3 -0
- package/commands/version.d.ts.map +1 -0
- package/commands/version.js +11 -0
- package/commands/version.js.map +1 -0
- package/config/config.d.ts +39 -0
- package/config/config.d.ts.map +1 -0
- package/config/config.js +85 -0
- package/config/config.js.map +1 -0
- package/config/index.d.ts +5 -0
- package/config/index.d.ts.map +1 -0
- package/config/index.js +6 -0
- package/config/index.js.map +1 -0
- package/config/keys.d.ts +6 -0
- package/config/keys.d.ts.map +1 -0
- package/config/keys.js +53 -0
- package/config/keys.js.map +1 -0
- package/config/paths.d.ts +10 -0
- package/config/paths.d.ts.map +1 -0
- package/config/paths.js +21 -0
- package/config/paths.js.map +1 -0
- package/config/resolve.d.ts +33 -0
- package/config/resolve.d.ts.map +1 -0
- package/config/resolve.js +77 -0
- package/config/resolve.js.map +1 -0
- package/errors/classify.d.ts +17 -0
- package/errors/classify.d.ts.map +1 -0
- package/errors/classify.js +158 -0
- package/errors/classify.js.map +1 -0
- package/errors/cli-exit-error.d.ts +6 -0
- package/errors/cli-exit-error.d.ts.map +1 -0
- package/errors/cli-exit-error.js +15 -0
- package/errors/cli-exit-error.js.map +1 -0
- package/errors/exit-codes.d.ts +10 -0
- package/errors/exit-codes.d.ts.map +1 -0
- package/errors/exit-codes.js +12 -0
- package/errors/exit-codes.js.map +1 -0
- package/errors/handle.d.ts +14 -0
- package/errors/handle.d.ts.map +1 -0
- package/errors/handle.js +46 -0
- package/errors/handle.js.map +1 -0
- package/errors/index.d.ts +6 -0
- package/errors/index.d.ts.map +1 -0
- package/errors/index.js +7 -0
- package/errors/index.js.map +1 -0
- package/errors/usage-error.d.ts +5 -0
- package/errors/usage-error.d.ts.map +1 -0
- package/errors/usage-error.js +13 -0
- package/errors/usage-error.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +8 -0
- package/index.js.map +1 -0
- package/local/artifact.d.ts +38 -0
- package/local/artifact.d.ts.map +1 -0
- package/local/artifact.js +133 -0
- package/local/artifact.js.map +1 -0
- package/local/constants.d.ts +36 -0
- package/local/constants.d.ts.map +1 -0
- package/local/constants.js +44 -0
- package/local/constants.js.map +1 -0
- package/local/daemon/components.d.ts +20 -0
- package/local/daemon/components.d.ts.map +1 -0
- package/local/daemon/components.js +105 -0
- package/local/daemon/components.js.map +1 -0
- package/local/daemon/env.d.ts +55 -0
- package/local/daemon/env.d.ts.map +1 -0
- package/local/daemon/env.js +82 -0
- package/local/daemon/env.js.map +1 -0
- package/local/daemon/host.d.ts +7 -0
- package/local/daemon/host.d.ts.map +1 -0
- package/local/daemon/host.js +74 -0
- package/local/daemon/host.js.map +1 -0
- package/local/daemon/index.d.ts +8 -0
- package/local/daemon/index.d.ts.map +1 -0
- package/local/daemon/index.js +8 -0
- package/local/daemon/index.js.map +1 -0
- package/local/daemon/launch.d.ts +11 -0
- package/local/daemon/launch.d.ts.map +1 -0
- package/local/daemon/launch.js +219 -0
- package/local/daemon/launch.js.map +1 -0
- package/local/daemon/process.d.ts +28 -0
- package/local/daemon/process.d.ts.map +1 -0
- package/local/daemon/process.js +149 -0
- package/local/daemon/process.js.map +1 -0
- package/local/daemon/supervisor.d.ts +56 -0
- package/local/daemon/supervisor.d.ts.map +1 -0
- package/local/daemon/supervisor.js +211 -0
- package/local/daemon/supervisor.js.map +1 -0
- package/local/daemon/types.d.ts +63 -0
- package/local/daemon/types.d.ts.map +1 -0
- package/local/daemon/types.js +9 -0
- package/local/daemon/types.js.map +1 -0
- package/local/llm-config.d.ts +30 -0
- package/local/llm-config.d.ts.map +1 -0
- package/local/llm-config.js +93 -0
- package/local/llm-config.js.map +1 -0
- package/local/logs/tail.d.ts +19 -0
- package/local/logs/tail.d.ts.map +1 -0
- package/local/logs/tail.js +86 -0
- package/local/logs/tail.js.map +1 -0
- package/local/logs/view.d.ts +20 -0
- package/local/logs/view.d.ts.map +1 -0
- package/local/logs/view.js +50 -0
- package/local/logs/view.js.map +1 -0
- package/local/net/tcp.d.ts +23 -0
- package/local/net/tcp.d.ts.map +1 -0
- package/local/net/tcp.js +47 -0
- package/local/net/tcp.js.map +1 -0
- package/local/paths.d.ts +26 -0
- package/local/paths.d.ts.map +1 -0
- package/local/paths.js +57 -0
- package/local/paths.js.map +1 -0
- package/local/reset.d.ts +14 -0
- package/local/reset.d.ts.map +1 -0
- package/local/reset.js +57 -0
- package/local/reset.js.map +1 -0
- package/local/runtime/index.d.ts +5 -0
- package/local/runtime/index.d.ts.map +1 -0
- package/local/runtime/index.js +6 -0
- package/local/runtime/index.js.map +1 -0
- package/local/runtime/node.d.ts +8 -0
- package/local/runtime/node.d.ts.map +1 -0
- package/local/runtime/node.js +59 -0
- package/local/runtime/node.js.map +1 -0
- package/local/runtime/runner.d.ts +40 -0
- package/local/runtime/runner.d.ts.map +1 -0
- package/local/runtime/runner.js +154 -0
- package/local/runtime/runner.js.map +1 -0
- package/local/runtime/server.d.ts +39 -0
- package/local/runtime/server.d.ts.map +1 -0
- package/local/runtime/server.js +141 -0
- package/local/runtime/server.js.map +1 -0
- package/local/runtime/which.d.ts +3 -0
- package/local/runtime/which.d.ts.map +1 -0
- package/local/runtime/which.js +30 -0
- package/local/runtime/which.js.map +1 -0
- package/local/seedpack/apply.d.ts +43 -0
- package/local/seedpack/apply.d.ts.map +1 -0
- package/local/seedpack/apply.js +94 -0
- package/local/seedpack/apply.js.map +1 -0
- package/local/seedpack/content.d.ts +56 -0
- package/local/seedpack/content.d.ts.map +1 -0
- package/local/seedpack/content.js +201 -0
- package/local/seedpack/content.js.map +1 -0
- package/local/setup/prompt.d.ts +8 -0
- package/local/setup/prompt.d.ts.map +1 -0
- package/local/setup/prompt.js +63 -0
- package/local/setup/prompt.js.map +1 -0
- package/local/setup/wizard.d.ts +22 -0
- package/local/setup/wizard.d.ts.map +1 -0
- package/local/setup/wizard.js +65 -0
- package/local/setup/wizard.js.map +1 -0
- package/local/state/health-state.d.ts +26 -0
- package/local/state/health-state.d.ts.map +1 -0
- package/local/state/health-state.js +34 -0
- package/local/state/health-state.js.map +1 -0
- package/local/state/index.d.ts +7 -0
- package/local/state/index.d.ts.map +1 -0
- package/local/state/index.js +8 -0
- package/local/state/index.js.map +1 -0
- package/local/state/lock.d.ts +12 -0
- package/local/state/lock.d.ts.map +1 -0
- package/local/state/lock.js +70 -0
- package/local/state/lock.js.map +1 -0
- package/local/state/log-rotation.d.ts +17 -0
- package/local/state/log-rotation.d.ts.map +1 -0
- package/local/state/log-rotation.js +101 -0
- package/local/state/log-rotation.js.map +1 -0
- package/local/state/pidfile.d.ts +11 -0
- package/local/state/pidfile.d.ts.map +1 -0
- package/local/state/pidfile.js +35 -0
- package/local/state/pidfile.js.map +1 -0
- package/local/state/proc.d.ts +16 -0
- package/local/state/proc.d.ts.map +1 -0
- package/local/state/proc.js +69 -0
- package/local/state/proc.js.map +1 -0
- package/local/state/startup-config.d.ts +23 -0
- package/local/state/startup-config.d.ts.map +1 -0
- package/local/state/startup-config.js +33 -0
- package/local/state/startup-config.js.map +1 -0
- package/local/status.d.ts +9 -0
- package/local/status.d.ts.map +1 -0
- package/local/status.js +168 -0
- package/local/status.js.map +1 -0
- package/local/temporal/download.d.ts +20 -0
- package/local/temporal/download.d.ts.map +1 -0
- package/local/temporal/download.js +36 -0
- package/local/temporal/download.js.map +1 -0
- package/local/temporal/index.d.ts +5 -0
- package/local/temporal/index.d.ts.map +1 -0
- package/local/temporal/index.js +6 -0
- package/local/temporal/index.js.map +1 -0
- package/local/temporal/inspect.d.ts +8 -0
- package/local/temporal/inspect.d.ts.map +1 -0
- package/local/temporal/inspect.js +33 -0
- package/local/temporal/inspect.js.map +1 -0
- package/local/temporal/manager.d.ts +50 -0
- package/local/temporal/manager.d.ts.map +1 -0
- package/local/temporal/manager.js +208 -0
- package/local/temporal/manager.js.map +1 -0
- package/local/temporal/supervisor.d.ts +34 -0
- package/local/temporal/supervisor.d.ts.map +1 -0
- package/local/temporal/supervisor.js +83 -0
- package/local/temporal/supervisor.js.map +1 -0
- package/local/webconsole/index.d.ts +4 -0
- package/local/webconsole/index.d.ts.map +1 -0
- package/local/webconsole/index.js +13 -0
- package/local/webconsole/index.js.map +1 -0
- package/logger.d.ts +13 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +35 -0
- package/logger.js.map +1 -0
- package/output/command-result.d.ts +47 -0
- package/output/command-result.d.ts.map +1 -0
- package/output/command-result.js +134 -0
- package/output/command-result.js.map +1 -0
- package/output/confirm.d.ts +22 -0
- package/output/confirm.d.ts.map +1 -0
- package/output/confirm.js +42 -0
- package/output/confirm.js.map +1 -0
- package/output/format.d.ts +22 -0
- package/output/format.d.ts.map +1 -0
- package/output/format.js +72 -0
- package/output/format.js.map +1 -0
- package/output/index.d.ts +7 -0
- package/output/index.d.ts.map +1 -0
- package/output/index.js +8 -0
- package/output/index.js.map +1 -0
- package/output/ndjson.d.ts +24 -0
- package/output/ndjson.d.ts.map +1 -0
- package/output/ndjson.js +38 -0
- package/output/ndjson.js.map +1 -0
- package/output/proto.d.ts +12 -0
- package/output/proto.d.ts.map +1 -0
- package/output/proto.js +34 -0
- package/output/proto.js.map +1 -0
- package/output/style.d.ts +19 -0
- package/output/style.d.ts.map +1 -0
- package/output/style.js +44 -0
- package/output/style.js.map +1 -0
- package/output/table.d.ts +5 -0
- package/output/table.d.ts.map +1 -0
- package/output/table.js +43 -0
- package/output/table.js.map +1 -0
- package/package.json +49 -0
- package/program.d.ts +3 -0
- package/program.d.ts.map +1 -0
- package/program.js +95 -0
- package/program.js.map +1 -0
- package/registry/aliases.d.ts +18 -0
- package/registry/aliases.d.ts.map +1 -0
- package/registry/aliases.js +85 -0
- package/registry/aliases.js.map +1 -0
- package/registry/index.d.ts +6 -0
- package/registry/index.d.ts.map +1 -0
- package/registry/index.js +7 -0
- package/registry/index.js.map +1 -0
- package/registry/metadata.d.ts +12 -0
- package/registry/metadata.d.ts.map +1 -0
- package/registry/metadata.js +49 -0
- package/registry/metadata.js.map +1 -0
- package/registry/registry.d.ts +39 -0
- package/registry/registry.d.ts.map +1 -0
- package/registry/registry.js +59 -0
- package/registry/registry.js.map +1 -0
- package/registry/verb-support.d.ts +5 -0
- package/registry/verb-support.d.ts.map +1 -0
- package/registry/verb-support.js +48 -0
- package/registry/verb-support.js.map +1 -0
- package/registry/verbs.d.ts +16 -0
- package/registry/verbs.d.ts.map +1 -0
- package/registry/verbs.js +36 -0
- package/registry/verbs.js.map +1 -0
- package/resources/apply/apply.d.ts +55 -0
- package/resources/apply/apply.d.ts.map +1 -0
- package/resources/apply/apply.js +163 -0
- package/resources/apply/apply.js.map +1 -0
- package/resources/apply/declarative.d.ts +106 -0
- package/resources/apply/declarative.d.ts.map +1 -0
- package/resources/apply/declarative.js +378 -0
- package/resources/apply/declarative.js.map +1 -0
- package/resources/apply/discovery.d.ts +7 -0
- package/resources/apply/discovery.d.ts.map +1 -0
- package/resources/apply/discovery.js +47 -0
- package/resources/apply/discovery.js.map +1 -0
- package/resources/apply/handlers.d.ts +15 -0
- package/resources/apply/handlers.d.ts.map +1 -0
- package/resources/apply/handlers.js +126 -0
- package/resources/apply/handlers.js.map +1 -0
- package/resources/apply/synth/project-track.d.ts +21 -0
- package/resources/apply/synth/project-track.d.ts.map +1 -0
- package/resources/apply/synth/project-track.js +102 -0
- package/resources/apply/synth/project-track.js.map +1 -0
- package/resources/apply/synth/reader.d.ts +18 -0
- package/resources/apply/synth/reader.d.ts.map +1 -0
- package/resources/apply/synth/reader.js +55 -0
- package/resources/apply/synth/reader.js.map +1 -0
- package/resources/apply/synth/runtime.d.ts +8 -0
- package/resources/apply/synth/runtime.d.ts.map +1 -0
- package/resources/apply/synth/runtime.js +32 -0
- package/resources/apply/synth/runtime.js.map +1 -0
- package/resources/apply/synth/synthesize.d.ts +43 -0
- package/resources/apply/synth/synthesize.d.ts.map +1 -0
- package/resources/apply/synth/synthesize.js +115 -0
- package/resources/apply/synth/synthesize.js.map +1 -0
- package/resources/connect/connect.d.ts +24 -0
- package/resources/connect/connect.d.ts.map +1 -0
- package/resources/connect/connect.js +71 -0
- package/resources/connect/connect.js.map +1 -0
- package/resources/connect/discover.d.ts +5 -0
- package/resources/connect/discover.d.ts.map +1 -0
- package/resources/connect/discover.js +100 -0
- package/resources/connect/discover.js.map +1 -0
- package/resources/connect/display.d.ts +5 -0
- package/resources/connect/display.d.ts.map +1 -0
- package/resources/connect/display.js +58 -0
- package/resources/connect/display.js.map +1 -0
- package/resources/connect/oauth.d.ts +45 -0
- package/resources/connect/oauth.d.ts.map +1 -0
- package/resources/connect/oauth.js +152 -0
- package/resources/connect/oauth.js.map +1 -0
- package/resources/delete.d.ts +18 -0
- package/resources/delete.d.ts.map +1 -0
- package/resources/delete.js +180 -0
- package/resources/delete.js.map +1 -0
- package/resources/diff.d.ts +16 -0
- package/resources/diff.d.ts.map +1 -0
- package/resources/diff.js +158 -0
- package/resources/diff.js.map +1 -0
- package/resources/documents.d.ts +16 -0
- package/resources/documents.d.ts.map +1 -0
- package/resources/documents.js +89 -0
- package/resources/documents.js.map +1 -0
- package/resources/download.d.ts +16 -0
- package/resources/download.d.ts.map +1 -0
- package/resources/download.js +107 -0
- package/resources/download.js.map +1 -0
- package/resources/execution-approve.d.ts +26 -0
- package/resources/execution-approve.d.ts.map +1 -0
- package/resources/execution-approve.js +69 -0
- package/resources/execution-approve.js.map +1 -0
- package/resources/execution-control.d.ts +16 -0
- package/resources/execution-control.d.ts.map +1 -0
- package/resources/execution-control.js +57 -0
- package/resources/execution-control.js.map +1 -0
- package/resources/execution-format.d.ts +12 -0
- package/resources/execution-format.d.ts.map +1 -0
- package/resources/execution-format.js +56 -0
- package/resources/execution-format.js.map +1 -0
- package/resources/execution-logs.d.ts +16 -0
- package/resources/execution-logs.d.ts.map +1 -0
- package/resources/execution-logs.js +132 -0
- package/resources/execution-logs.js.map +1 -0
- package/resources/execution-trace.d.ts +10 -0
- package/resources/execution-trace.d.ts.map +1 -0
- package/resources/execution-trace.js +125 -0
- package/resources/execution-trace.js.map +1 -0
- package/resources/execution.d.ts +59 -0
- package/resources/execution.d.ts.map +1 -0
- package/resources/execution.js +192 -0
- package/resources/execution.js.map +1 -0
- package/resources/get-bindings.d.ts +12 -0
- package/resources/get-bindings.d.ts.map +1 -0
- package/resources/get-bindings.js +40 -0
- package/resources/get-bindings.js.map +1 -0
- package/resources/get.d.ts +6 -0
- package/resources/get.d.ts.map +1 -0
- package/resources/get.js +31 -0
- package/resources/get.js.map +1 -0
- package/resources/git.d.ts +15 -0
- package/resources/git.d.ts.map +1 -0
- package/resources/git.js +69 -0
- package/resources/git.js.map +1 -0
- package/resources/ignore/defaults.d.ts +2 -0
- package/resources/ignore/defaults.d.ts.map +1 -0
- package/resources/ignore/defaults.js +140 -0
- package/resources/ignore/defaults.js.map +1 -0
- package/resources/ignore/index.d.ts +5 -0
- package/resources/ignore/index.d.ts.map +1 -0
- package/resources/ignore/index.js +6 -0
- package/resources/ignore/index.js.map +1 -0
- package/resources/ignore/match.d.ts +3 -0
- package/resources/ignore/match.d.ts.map +1 -0
- package/resources/ignore/match.js +166 -0
- package/resources/ignore/match.js.map +1 -0
- package/resources/ignore/matcher.d.ts +44 -0
- package/resources/ignore/matcher.d.ts.map +1 -0
- package/resources/ignore/matcher.js +125 -0
- package/resources/ignore/matcher.js.map +1 -0
- package/resources/ignore/pattern.d.ts +13 -0
- package/resources/ignore/pattern.d.ts.map +1 -0
- package/resources/ignore/pattern.js +118 -0
- package/resources/ignore/pattern.js.map +1 -0
- package/resources/list.d.ts +7 -0
- package/resources/list.d.ts.map +1 -0
- package/resources/list.js +82 -0
- package/resources/list.js.map +1 -0
- package/resources/mcp/runtime-env.d.ts +23 -0
- package/resources/mcp/runtime-env.d.ts.map +1 -0
- package/resources/mcp/runtime-env.js +68 -0
- package/resources/mcp/runtime-env.js.map +1 -0
- package/resources/picker/ink.d.ts +35 -0
- package/resources/picker/ink.d.ts.map +1 -0
- package/resources/picker/ink.js +45 -0
- package/resources/picker/ink.js.map +1 -0
- package/resources/picker/tty.d.ts +19 -0
- package/resources/picker/tty.d.ts.map +1 -0
- package/resources/picker/tty.js +21 -0
- package/resources/picker/tty.js.map +1 -0
- package/resources/reference.d.ts +32 -0
- package/resources/reference.d.ts.map +1 -0
- package/resources/reference.js +128 -0
- package/resources/reference.js.map +1 -0
- package/resources/render.d.ts +28 -0
- package/resources/render.d.ts.map +1 -0
- package/resources/render.js +87 -0
- package/resources/render.js.map +1 -0
- package/resources/run/agent-exec.d.ts +15 -0
- package/resources/run/agent-exec.d.ts.map +1 -0
- package/resources/run/agent-exec.js +81 -0
- package/resources/run/agent-exec.js.map +1 -0
- package/resources/run/attachments.d.ts +24 -0
- package/resources/run/attachments.d.ts.map +1 -0
- package/resources/run/attachments.js +209 -0
- package/resources/run/attachments.js.map +1 -0
- package/resources/run/create.d.ts +56 -0
- package/resources/run/create.d.ts.map +1 -0
- package/resources/run/create.js +105 -0
- package/resources/run/create.js.map +1 -0
- package/resources/run/env.d.ts +18 -0
- package/resources/run/env.d.ts.map +1 -0
- package/resources/run/env.js +147 -0
- package/resources/run/env.js.map +1 -0
- package/resources/run/epilogue.d.ts +9 -0
- package/resources/run/epilogue.d.ts.map +1 -0
- package/resources/run/epilogue.js +144 -0
- package/resources/run/epilogue.js.map +1 -0
- package/resources/run/header.d.ts +23 -0
- package/resources/run/header.d.ts.map +1 -0
- package/resources/run/header.js +51 -0
- package/resources/run/header.js.map +1 -0
- package/resources/run/prepare.d.ts +60 -0
- package/resources/run/prepare.d.ts.map +1 -0
- package/resources/run/prepare.js +78 -0
- package/resources/run/prepare.js.map +1 -0
- package/resources/run/resolve.d.ts +8 -0
- package/resources/run/resolve.d.ts.map +1 -0
- package/resources/run/resolve.js +28 -0
- package/resources/run/resolve.js.map +1 -0
- package/resources/run/resume.d.ts +13 -0
- package/resources/run/resume.d.ts.map +1 -0
- package/resources/run/resume.js +94 -0
- package/resources/run/resume.js.map +1 -0
- package/resources/run/stream.d.ts +24 -0
- package/resources/run/stream.d.ts.map +1 -0
- package/resources/run/stream.js +80 -0
- package/resources/run/stream.js.map +1 -0
- package/resources/run/workflow-stream.d.ts +25 -0
- package/resources/run/workflow-stream.d.ts.map +1 -0
- package/resources/run/workflow-stream.js +152 -0
- package/resources/run/workflow-stream.js.map +1 -0
- package/resources/run/workspace.d.ts +17 -0
- package/resources/run/workspace.d.ts.map +1 -0
- package/resources/run/workspace.js +147 -0
- package/resources/run/workspace.js.map +1 -0
- package/resources/search.d.ts +22 -0
- package/resources/search.d.ts.map +1 -0
- package/resources/search.js +23 -0
- package/resources/search.js.map +1 -0
- package/resources/session.d.ts +19 -0
- package/resources/session.d.ts.map +1 -0
- package/resources/session.js +51 -0
- package/resources/session.js.map +1 -0
- package/resources/skill.d.ts +84 -0
- package/resources/skill.d.ts.map +1 -0
- package/resources/skill.js +342 -0
- package/resources/skill.js.map +1 -0
- package/resources/stream/approval-detect.d.ts +38 -0
- package/resources/stream/approval-detect.d.ts.map +1 -0
- package/resources/stream/approval-detect.js +93 -0
- package/resources/stream/approval-detect.js.map +1 -0
- package/resources/stream/convert.d.ts +38 -0
- package/resources/stream/convert.d.ts.map +1 -0
- package/resources/stream/convert.js +178 -0
- package/resources/stream/convert.js.map +1 -0
- package/resources/stream/diff.d.ts +29 -0
- package/resources/stream/diff.d.ts.map +1 -0
- package/resources/stream/diff.js +214 -0
- package/resources/stream/diff.js.map +1 -0
- package/resources/stream/events.d.ts +137 -0
- package/resources/stream/events.d.ts.map +1 -0
- package/resources/stream/events.js +15 -0
- package/resources/stream/events.js.map +1 -0
- package/resources/stream/headless.d.ts +38 -0
- package/resources/stream/headless.d.ts.map +1 -0
- package/resources/stream/headless.js +75 -0
- package/resources/stream/headless.js.map +1 -0
- package/resources/stream/ink.d.ts +22 -0
- package/resources/stream/ink.d.ts.map +1 -0
- package/resources/stream/ink.js +24 -0
- package/resources/stream/ink.js.map +1 -0
- package/resources/stream/render-ndjson.d.ts +25 -0
- package/resources/stream/render-ndjson.d.ts.map +1 -0
- package/resources/stream/render-ndjson.js +156 -0
- package/resources/stream/render-ndjson.js.map +1 -0
- package/resources/stream/render-plaintext.d.ts +18 -0
- package/resources/stream/render-plaintext.d.ts.map +1 -0
- package/resources/stream/render-plaintext.js +71 -0
- package/resources/stream/render-plaintext.js.map +1 -0
- package/resources/stream/snapshot.d.ts +8 -0
- package/resources/stream/snapshot.d.ts.map +1 -0
- package/resources/stream/snapshot.js +163 -0
- package/resources/stream/snapshot.js.map +1 -0
- package/resources/stream/subagent.d.ts +12 -0
- package/resources/stream/subagent.d.ts.map +1 -0
- package/resources/stream/subagent.js +76 -0
- package/resources/stream/subagent.js.map +1 -0
- package/resources/stream/submit.d.ts +20 -0
- package/resources/stream/submit.d.ts.map +1 -0
- package/resources/stream/submit.js +125 -0
- package/resources/stream/submit.js.map +1 -0
- package/resources/stream/todo.d.ts +11 -0
- package/resources/stream/todo.d.ts.map +1 -0
- package/resources/stream/todo.js +44 -0
- package/resources/stream/todo.js.map +1 -0
- package/resources/stream/tool-state.d.ts +31 -0
- package/resources/stream/tool-state.d.ts.map +1 -0
- package/resources/stream/tool-state.js +126 -0
- package/resources/stream/tool-state.js.map +1 -0
- package/resources/stream/tty.d.ts +8 -0
- package/resources/stream/tty.d.ts.map +1 -0
- package/resources/stream/tty.js +15 -0
- package/resources/stream/tty.js.map +1 -0
- package/resources/stream/workflow-event-view.d.ts +21 -0
- package/resources/stream/workflow-event-view.d.ts.map +1 -0
- package/resources/stream/workflow-event-view.js +88 -0
- package/resources/stream/workflow-event-view.js.map +1 -0
- package/resources/stream/workflow-render-ndjson.d.ts +5 -0
- package/resources/stream/workflow-render-ndjson.d.ts.map +1 -0
- package/resources/stream/workflow-render-ndjson.js +54 -0
- package/resources/stream/workflow-render-ndjson.js.map +1 -0
- package/resources/stream/workflow-render-plaintext.d.ts +8 -0
- package/resources/stream/workflow-render-plaintext.d.ts.map +1 -0
- package/resources/stream/workflow-render-plaintext.js +34 -0
- package/resources/stream/workflow-render-plaintext.js.map +1 -0
- package/resources/tag.d.ts +4 -0
- package/resources/tag.d.ts.map +1 -0
- package/resources/tag.js +36 -0
- package/resources/tag.js.map +1 -0
- package/resources/usage.d.ts +14 -0
- package/resources/usage.d.ts.map +1 -0
- package/resources/usage.js +251 -0
- package/resources/usage.js.map +1 -0
- package/resources/validate.d.ts +6 -0
- package/resources/validate.d.ts.map +1 -0
- package/resources/validate.js +28 -0
- package/resources/validate.js.map +1 -0
- package/resources/version.d.ts +6 -0
- package/resources/version.d.ts.map +1 -0
- package/resources/version.js +75 -0
- package/resources/version.js.map +1 -0
- package/runtime.d.ts +5 -0
- package/runtime.d.ts.map +1 -0
- package/runtime.js +19 -0
- package/runtime.js.map +1 -0
- package/src/auth/auth0.ts +43 -0
- package/src/auth/callback-server.ts +104 -0
- package/src/auth/index.ts +6 -0
- package/src/auth/login.ts +61 -0
- package/src/auth/pages.ts +31 -0
- package/src/auth/pkce.test.ts +37 -0
- package/src/auth/pkce.ts +26 -0
- package/src/auth/token.test.ts +95 -0
- package/src/auth/token.ts +135 -0
- package/src/backend.ts +15 -0
- package/src/cli/stigmer.ts +16 -0
- package/src/client/client.test.ts +46 -0
- package/src/client/client.ts +84 -0
- package/src/client/index.ts +3 -0
- package/src/commands/agent-exec-flags.ts +75 -0
- package/src/commands/apikey/duration.test.ts +23 -0
- package/src/commands/apikey/duration.ts +35 -0
- package/src/commands/apikey/index.ts +133 -0
- package/src/commands/apply.ts +213 -0
- package/src/commands/auth/index.ts +87 -0
- package/src/commands/completion.ts +96 -0
- package/src/commands/config/backend.ts +58 -0
- package/src/commands/config/context.ts +26 -0
- package/src/commands/config/index.ts +18 -0
- package/src/commands/config/kv.ts +44 -0
- package/src/commands/connect.ts +75 -0
- package/src/commands/delete.ts +56 -0
- package/src/commands/diff.ts +97 -0
- package/src/commands/down.ts +27 -0
- package/src/commands/download.ts +68 -0
- package/src/commands/draft.ts +128 -0
- package/src/commands/execution/approve.ts +76 -0
- package/src/commands/execution/control.ts +79 -0
- package/src/commands/execution/index.ts +24 -0
- package/src/commands/execution/logs.ts +47 -0
- package/src/commands/execution/trace.ts +32 -0
- package/src/commands/get.ts +99 -0
- package/src/commands/internal-daemon.ts +25 -0
- package/src/commands/list.ts +138 -0
- package/src/commands/logs.ts +73 -0
- package/src/commands/mcp-server.test.ts +65 -0
- package/src/commands/mcp-server.ts +124 -0
- package/src/commands/push.ts +205 -0
- package/src/commands/reset.ts +57 -0
- package/src/commands/resume.ts +121 -0
- package/src/commands/run.ts +276 -0
- package/src/commands/search.ts +90 -0
- package/src/commands/seedpack.ts +94 -0
- package/src/commands/setup.ts +71 -0
- package/src/commands/shared.ts +41 -0
- package/src/commands/status.ts +20 -0
- package/src/commands/tag.ts +31 -0
- package/src/commands/up.ts +51 -0
- package/src/commands/usage.ts +74 -0
- package/src/commands/validate.test.ts +79 -0
- package/src/commands/validate.ts +73 -0
- package/src/commands/version.ts +13 -0
- package/src/config/config.test.ts +76 -0
- package/src/config/config.ts +127 -0
- package/src/config/index.ts +22 -0
- package/src/config/keys.test.ts +38 -0
- package/src/config/keys.ts +64 -0
- package/src/config/paths.ts +25 -0
- package/src/config/resolve.test.ts +103 -0
- package/src/config/resolve.ts +80 -0
- package/src/errors/classify.ts +199 -0
- package/src/errors/cli-exit-error.ts +16 -0
- package/src/errors/clierr.test.ts +172 -0
- package/src/errors/exit-codes.ts +14 -0
- package/src/errors/handle.ts +53 -0
- package/src/errors/index.ts +7 -0
- package/src/errors/usage-error.ts +14 -0
- package/src/index.ts +8 -0
- package/src/local/artifact.test.ts +28 -0
- package/src/local/artifact.ts +166 -0
- package/src/local/constants.ts +52 -0
- package/src/local/daemon/components.test.ts +80 -0
- package/src/local/daemon/components.ts +113 -0
- package/src/local/daemon/daemon.integration.test.ts +183 -0
- package/src/local/daemon/env.test.ts +51 -0
- package/src/local/daemon/env.ts +118 -0
- package/src/local/daemon/host.ts +79 -0
- package/src/local/daemon/index.ts +18 -0
- package/src/local/daemon/launch.ts +260 -0
- package/src/local/daemon/process.ts +183 -0
- package/src/local/daemon/supervisor.test.ts +260 -0
- package/src/local/daemon/supervisor.ts +249 -0
- package/src/local/daemon/types.ts +76 -0
- package/src/local/llm-config.test.ts +80 -0
- package/src/local/llm-config.ts +107 -0
- package/src/local/logs/tail.test.ts +70 -0
- package/src/local/logs/tail.ts +100 -0
- package/src/local/logs/view.test.ts +46 -0
- package/src/local/logs/view.ts +65 -0
- package/src/local/net/tcp.ts +65 -0
- package/src/local/paths.ts +67 -0
- package/src/local/reset.test.ts +53 -0
- package/src/local/reset.ts +90 -0
- package/src/local/runtime/index.ts +18 -0
- package/src/local/runtime/node.ts +67 -0
- package/src/local/runtime/runner.ts +186 -0
- package/src/local/runtime/runtime.test.ts +155 -0
- package/src/local/runtime/server.test.ts +152 -0
- package/src/local/runtime/server.ts +172 -0
- package/src/local/runtime/which.ts +30 -0
- package/src/local/seedpack/apply.test.ts +166 -0
- package/src/local/seedpack/apply.ts +139 -0
- package/src/local/seedpack/content.test.ts +148 -0
- package/src/local/seedpack/content.ts +223 -0
- package/src/local/setup/prompt.ts +70 -0
- package/src/local/setup/wizard.test.ts +42 -0
- package/src/local/setup/wizard.ts +78 -0
- package/src/local/state/health-state.ts +55 -0
- package/src/local/state/index.ts +8 -0
- package/src/local/state/lock.ts +77 -0
- package/src/local/state/log-rotation.ts +112 -0
- package/src/local/state/pidfile.ts +37 -0
- package/src/local/state/proc.ts +66 -0
- package/src/local/state/startup-config.ts +51 -0
- package/src/local/state/state.test.ts +166 -0
- package/src/local/status.test.ts +88 -0
- package/src/local/status.ts +186 -0
- package/src/local/temporal/download.test.ts +64 -0
- package/src/local/temporal/download.ts +54 -0
- package/src/local/temporal/index.ts +6 -0
- package/src/local/temporal/inspect.ts +32 -0
- package/src/local/temporal/manager.test.ts +31 -0
- package/src/local/temporal/manager.ts +247 -0
- package/src/local/temporal/supervisor.test.ts +77 -0
- package/src/local/temporal/supervisor.ts +97 -0
- package/src/local/webconsole/index.ts +13 -0
- package/src/logger.ts +39 -0
- package/src/output/command-result.test.ts +64 -0
- package/src/output/command-result.ts +185 -0
- package/src/output/confirm.test.ts +43 -0
- package/src/output/confirm.ts +53 -0
- package/src/output/format.test.ts +65 -0
- package/src/output/format.ts +101 -0
- package/src/output/index.ts +30 -0
- package/src/output/ndjson.ts +55 -0
- package/src/output/proto.test.ts +72 -0
- package/src/output/proto.ts +55 -0
- package/src/output/style.ts +57 -0
- package/src/output/table.test.ts +37 -0
- package/src/output/table.ts +52 -0
- package/src/program.test.ts +64 -0
- package/src/program.ts +100 -0
- package/src/registry/aliases.test.ts +99 -0
- package/src/registry/aliases.ts +93 -0
- package/src/registry/index.ts +7 -0
- package/src/registry/metadata.ts +60 -0
- package/src/registry/registry.test.ts +80 -0
- package/src/registry/registry.ts +101 -0
- package/src/registry/verb-support.ts +50 -0
- package/src/registry/verbs.ts +43 -0
- package/src/resources/apply/apply.integration.test.ts +207 -0
- package/src/resources/apply/apply.ts +202 -0
- package/src/resources/apply/declarative.integration.test.ts +126 -0
- package/src/resources/apply/declarative.test.ts +132 -0
- package/src/resources/apply/declarative.ts +474 -0
- package/src/resources/apply/discovery.ts +60 -0
- package/src/resources/apply/handlers.ts +145 -0
- package/src/resources/apply/synth/capstone.integration.test.ts +134 -0
- package/src/resources/apply/synth/project-track.integration.test.ts +194 -0
- package/src/resources/apply/synth/project-track.ts +126 -0
- package/src/resources/apply/synth/reader.test.ts +90 -0
- package/src/resources/apply/synth/reader.ts +68 -0
- package/src/resources/apply/synth/runtime.test.ts +29 -0
- package/src/resources/apply/synth/runtime.ts +39 -0
- package/src/resources/apply/synth/synthesize.test.ts +109 -0
- package/src/resources/apply/synth/synthesize.ts +161 -0
- package/src/resources/connect/__fixtures__/stdio-crash.mjs +6 -0
- package/src/resources/connect/__fixtures__/stdio-server.mjs +43 -0
- package/src/resources/connect/connect.integration.test.ts +185 -0
- package/src/resources/connect/connect.ts +107 -0
- package/src/resources/connect/discover.test.ts +45 -0
- package/src/resources/connect/discover.ts +125 -0
- package/src/resources/connect/display.ts +68 -0
- package/src/resources/connect/oauth.test.ts +155 -0
- package/src/resources/connect/oauth.ts +191 -0
- package/src/resources/delete.ts +239 -0
- package/src/resources/diff.integration.test.ts +103 -0
- package/src/resources/diff.test.ts +34 -0
- package/src/resources/diff.ts +187 -0
- package/src/resources/documents.test.ts +67 -0
- package/src/resources/documents.ts +102 -0
- package/src/resources/download.ts +151 -0
- package/src/resources/execution-approve.test.ts +50 -0
- package/src/resources/execution-approve.ts +94 -0
- package/src/resources/execution-control.ts +78 -0
- package/src/resources/execution-format.test.ts +48 -0
- package/src/resources/execution-format.ts +54 -0
- package/src/resources/execution-logs.ts +176 -0
- package/src/resources/execution-trace.ts +159 -0
- package/src/resources/execution.integration.test.ts +285 -0
- package/src/resources/execution.test.ts +138 -0
- package/src/resources/execution.ts +229 -0
- package/src/resources/get-bindings.ts +61 -0
- package/src/resources/get.ts +41 -0
- package/src/resources/git.ts +71 -0
- package/src/resources/ignore/defaults.ts +155 -0
- package/src/resources/ignore/ignore.test.ts +139 -0
- package/src/resources/ignore/index.ts +17 -0
- package/src/resources/ignore/match.ts +158 -0
- package/src/resources/ignore/matcher.ts +158 -0
- package/src/resources/ignore/pattern.ts +131 -0
- package/src/resources/list.ts +97 -0
- package/src/resources/mcp/runtime-env.test.ts +68 -0
- package/src/resources/mcp/runtime-env.ts +79 -0
- package/src/resources/mutate-verbs.integration.test.ts +233 -0
- package/src/resources/picker/ink.tsx +114 -0
- package/src/resources/picker/tty.test.ts +37 -0
- package/src/resources/picker/tty.ts +30 -0
- package/src/resources/push-download.integration.test.ts +175 -0
- package/src/resources/read-completion.integration.test.ts +156 -0
- package/src/resources/read-verbs.integration.test.ts +164 -0
- package/src/resources/reference.test.ts +107 -0
- package/src/resources/reference.ts +140 -0
- package/src/resources/render.ts +118 -0
- package/src/resources/run/agent-exec.ts +107 -0
- package/src/resources/run/attachments.test.ts +113 -0
- package/src/resources/run/attachments.ts +261 -0
- package/src/resources/run/create.test.ts +119 -0
- package/src/resources/run/create.ts +165 -0
- package/src/resources/run/env.test.ts +131 -0
- package/src/resources/run/env.ts +167 -0
- package/src/resources/run/epilogue.ts +166 -0
- package/src/resources/run/header.test.ts +61 -0
- package/src/resources/run/header.ts +62 -0
- package/src/resources/run/prepare.test.ts +92 -0
- package/src/resources/run/prepare.ts +139 -0
- package/src/resources/run/resolve.ts +32 -0
- package/src/resources/run/resume.ts +119 -0
- package/src/resources/run/stream.ts +108 -0
- package/src/resources/run/workflow-stream.integration.test.ts +157 -0
- package/src/resources/run/workflow-stream.ts +203 -0
- package/src/resources/run/workspace.test.ts +93 -0
- package/src/resources/run/workspace.ts +171 -0
- package/src/resources/search.ts +53 -0
- package/src/resources/session.test.ts +48 -0
- package/src/resources/session.ts +66 -0
- package/src/resources/skill.test.ts +227 -0
- package/src/resources/skill.ts +451 -0
- package/src/resources/stream/approval-detect.ts +118 -0
- package/src/resources/stream/convert.ts +210 -0
- package/src/resources/stream/diff.test.ts +316 -0
- package/src/resources/stream/diff.ts +254 -0
- package/src/resources/stream/events.ts +193 -0
- package/src/resources/stream/headless.test.ts +119 -0
- package/src/resources/stream/headless.ts +112 -0
- package/src/resources/stream/ink.tsx +56 -0
- package/src/resources/stream/lazy-import.test.ts +63 -0
- package/src/resources/stream/render-ndjson.test.ts +116 -0
- package/src/resources/stream/render-ndjson.ts +176 -0
- package/src/resources/stream/render-plaintext.test.ts +68 -0
- package/src/resources/stream/render-plaintext.ts +86 -0
- package/src/resources/stream/snapshot.test.ts +97 -0
- package/src/resources/stream/snapshot.ts +191 -0
- package/src/resources/stream/subagent.ts +104 -0
- package/src/resources/stream/submit.test.ts +77 -0
- package/src/resources/stream/submit.ts +137 -0
- package/src/resources/stream/todo.ts +53 -0
- package/src/resources/stream/tool-state.ts +142 -0
- package/src/resources/stream/tty.ts +14 -0
- package/src/resources/stream/workflow-event-view.test.ts +116 -0
- package/src/resources/stream/workflow-event-view.ts +111 -0
- package/src/resources/stream/workflow-render-ndjson.ts +61 -0
- package/src/resources/stream/workflow-render-plaintext.ts +43 -0
- package/src/resources/stream/workflow-render.test.ts +81 -0
- package/src/resources/tag.ts +50 -0
- package/src/resources/usage.test.ts +94 -0
- package/src/resources/usage.ts +301 -0
- package/src/resources/validate.test.ts +54 -0
- package/src/resources/validate.ts +31 -0
- package/src/resources/version.ts +105 -0
- package/src/runtime.ts +23 -0
- package/src/types/marked-terminal.d.ts +31 -0
- package/src/version.ts +46 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +45 -0
- package/version.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/local/daemon/process.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,gFAAgF;AAChF,2EAA2E;AAC3E,+EAA+E;AAC/E,mCAAmC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAe,GAAG,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAoB,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAqB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA2B/F,mEAAmE;AACnE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAwB;IAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,gBAAgB,EAAE,CAAC;IACjD,MAAM,IAAI,GAAG,IAAI,CA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B,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,0DAA0D;AAC1D,SAAS,aAAa,CAAC,MAAoB,EAAE,GAAW;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,UAAU,GAA8B,IAAI,CAAC;IACjD,OAAO;QACL,IAAI,OAAO;YACT,OAAO,OAAO,CAAC,OAAO,CAAC;QACzB,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE;QAC5B,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE;QAC1B,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE;QACpC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,GAAG,EAAE;YACpB,UAAU,GAAG,IAAI,kBAAkB,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YACtD,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;QACD,cAAc,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE;KACzC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type Logger } from "../../logger.js";
|
|
2
|
+
import type { HealthState } from "../state/health-state.js";
|
|
3
|
+
import type { Clock, ComponentSpec, ProcessHost } from "./types.js";
|
|
4
|
+
export declare const MAX_RESTARTS = 5;
|
|
5
|
+
export declare const RAPID_CRASH_WINDOW_MS = 5000;
|
|
6
|
+
export declare const MAX_UNHEALTHY_CHECKS = 3;
|
|
7
|
+
export declare const GRACEFUL_STOP_TIMEOUT_MS = 5000;
|
|
8
|
+
export declare const SETTLE_DELAY_MS = 2000;
|
|
9
|
+
export declare const HEALTH_CHECK_INTERVAL_MS = 10000;
|
|
10
|
+
export interface SupervisorDeps {
|
|
11
|
+
host: ProcessHost;
|
|
12
|
+
clock: Clock;
|
|
13
|
+
/** Shared snapshot; the supervisor owns the components map. */
|
|
14
|
+
healthState: HealthState;
|
|
15
|
+
/** Persist the snapshot (atomic health-state write). */
|
|
16
|
+
persist: () => void;
|
|
17
|
+
log?: Logger;
|
|
18
|
+
/** TCP probe for the server health check; injectable for tests. */
|
|
19
|
+
probe?: (port: number) => Promise<boolean>;
|
|
20
|
+
serverPort?: number;
|
|
21
|
+
}
|
|
22
|
+
/** Result of the initial start sequence. */
|
|
23
|
+
export interface StartResult {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
/** Name of the critical component that failed, if any. */
|
|
26
|
+
failedCritical?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class ProcessSupervisor {
|
|
29
|
+
private readonly managed;
|
|
30
|
+
private readonly host;
|
|
31
|
+
private readonly clock;
|
|
32
|
+
private readonly healthState;
|
|
33
|
+
private readonly persist;
|
|
34
|
+
private readonly log;
|
|
35
|
+
private readonly probe;
|
|
36
|
+
private readonly serverPort;
|
|
37
|
+
constructor(specs: ComponentSpec[], deps: SupervisorDeps);
|
|
38
|
+
/**
|
|
39
|
+
* Start all components in order. A critical component that fails to start or
|
|
40
|
+
* gate aborts startup (returns failedCritical); a non-critical failure is
|
|
41
|
+
* recorded and skipped.
|
|
42
|
+
*/
|
|
43
|
+
startAll(): Promise<StartResult>;
|
|
44
|
+
/** After a brief settle, mark any component that already crashed as failed. */
|
|
45
|
+
settleCheck(): void;
|
|
46
|
+
/** One health-monitor iteration: restart crashed children, probe the server. */
|
|
47
|
+
tick(): Promise<void>;
|
|
48
|
+
/** Gracefully stop all components in reverse start order. */
|
|
49
|
+
shutdown(): Promise<void>;
|
|
50
|
+
private probeServer;
|
|
51
|
+
private tryRestart;
|
|
52
|
+
private spawn;
|
|
53
|
+
private killAndWait;
|
|
54
|
+
private raceTimeout;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=supervisor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/local/daemon/supervisor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,MAAM,EAAqB,MAAM,iBAAiB,CAAC;AAEjE,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,KAAK,EAAe,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjF,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAC3C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,wBAAwB,OAAQ,CAAC;AAC9C,eAAO,MAAM,eAAe,OAAQ,CAAC;AACrC,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,+DAA+D;IAC/D,WAAW,EAAE,WAAW,CAAC;IACzB,wDAAwD;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAUD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAY;IACpC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqC;IAC3D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,KAAK,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,cAAc;IAgBxD;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;IAgCtC,+EAA+E;IAC/E,WAAW,IAAI,IAAI;IAWnB,gFAAgF;IAC1E,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB3B,6DAA6D;IACvD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAYjB,WAAW;YAsBX,UAAU;IA2BxB,OAAO,CAAC,KAAK;YAwBC,WAAW;YAYX,WAAW;CAM1B"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// The child-process supervision policy: start order, readiness gating, crash
|
|
2
|
+
// restart with rapid-crash and max-restart guards, server health probing, and
|
|
3
|
+
// reverse-order shutdown.
|
|
4
|
+
//
|
|
5
|
+
// Every side effect (spawning, time, the health probe) is injected, so this
|
|
6
|
+
// whole policy is unit-testable without real processes or real waiting — the
|
|
7
|
+
// property the Go daemon never had. process.ts wires this to the real host,
|
|
8
|
+
// clock, Temporal, signals, and the 10s tick.
|
|
9
|
+
import { SERVER_PORT } from "../constants.js";
|
|
10
|
+
import { log as defaultLog } from "../../logger.js";
|
|
11
|
+
import { tcpConnects } from "../net/tcp.js";
|
|
12
|
+
import { removePidFile, writePidFile } from "../state/pidfile.js";
|
|
13
|
+
export const MAX_RESTARTS = 5;
|
|
14
|
+
export const RAPID_CRASH_WINDOW_MS = 5_000;
|
|
15
|
+
export const MAX_UNHEALTHY_CHECKS = 3;
|
|
16
|
+
export const GRACEFUL_STOP_TIMEOUT_MS = 5_000;
|
|
17
|
+
export const SETTLE_DELAY_MS = 2_000;
|
|
18
|
+
export const HEALTH_CHECK_INTERVAL_MS = 10_000;
|
|
19
|
+
export class ProcessSupervisor {
|
|
20
|
+
managed;
|
|
21
|
+
host;
|
|
22
|
+
clock;
|
|
23
|
+
healthState;
|
|
24
|
+
persist;
|
|
25
|
+
log;
|
|
26
|
+
probe;
|
|
27
|
+
serverPort;
|
|
28
|
+
constructor(specs, deps) {
|
|
29
|
+
this.host = deps.host;
|
|
30
|
+
this.clock = deps.clock;
|
|
31
|
+
this.healthState = deps.healthState;
|
|
32
|
+
this.persist = deps.persist;
|
|
33
|
+
this.log = deps.log ?? defaultLog;
|
|
34
|
+
this.probe = deps.probe ?? ((port) => tcpConnects(port, "127.0.0.1", 500));
|
|
35
|
+
this.serverPort = deps.serverPort ?? SERVER_PORT;
|
|
36
|
+
this.managed = specs.map((spec) => {
|
|
37
|
+
const state = { pid: 0, state: "stopped", started_at: "", restart_count: 0 };
|
|
38
|
+
this.healthState.components[spec.name] = state;
|
|
39
|
+
return { spec, state, handle: null, unhealthyCount: 0, exitWaiter: null };
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Start all components in order. A critical component that fails to start or
|
|
44
|
+
* gate aborts startup (returns failedCritical); a non-critical failure is
|
|
45
|
+
* recorded and skipped.
|
|
46
|
+
*/
|
|
47
|
+
async startAll() {
|
|
48
|
+
for (const m of this.managed) {
|
|
49
|
+
this.log.info("starting component", { component: m.spec.name });
|
|
50
|
+
try {
|
|
51
|
+
this.spawn(m);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
m.state.state = "failed";
|
|
55
|
+
m.state.last_error = String(err);
|
|
56
|
+
this.log.error("failed to start component", { component: m.spec.name, error: String(err) });
|
|
57
|
+
if (m.spec.critical) {
|
|
58
|
+
this.persist();
|
|
59
|
+
return { ok: false, failedCritical: m.spec.name };
|
|
60
|
+
}
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (m.spec.gate !== undefined && m.handle !== null) {
|
|
64
|
+
try {
|
|
65
|
+
await m.spec.gate.wait(m.handle);
|
|
66
|
+
this.log.info("component ready", { component: m.spec.name, gate: m.spec.gate.description });
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
m.state.state = "failed";
|
|
70
|
+
m.state.last_error = `not ready: ${String(err)}`;
|
|
71
|
+
this.persist();
|
|
72
|
+
if (m.spec.critical)
|
|
73
|
+
return { ok: false, failedCritical: m.spec.name };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
this.persist();
|
|
78
|
+
return { ok: true };
|
|
79
|
+
}
|
|
80
|
+
/** After a brief settle, mark any component that already crashed as failed. */
|
|
81
|
+
settleCheck() {
|
|
82
|
+
for (const m of this.managed) {
|
|
83
|
+
if (m.handle !== null && m.handle.hasExited()) {
|
|
84
|
+
m.state.state = "failed";
|
|
85
|
+
m.state.last_error = "crashed during startup";
|
|
86
|
+
this.log.error("component crashed during startup", { component: m.spec.name, pid: m.state.pid });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
this.persist();
|
|
90
|
+
}
|
|
91
|
+
/** One health-monitor iteration: restart crashed children, probe the server. */
|
|
92
|
+
async tick() {
|
|
93
|
+
for (const m of this.managed) {
|
|
94
|
+
if (m.handle === null || m.state.state === "failed")
|
|
95
|
+
continue;
|
|
96
|
+
if (m.handle.hasExited()) {
|
|
97
|
+
this.log.warn("component exited, attempting restart", { component: m.spec.name, pid: m.state.pid });
|
|
98
|
+
await this.tryRestart(m);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (m.spec.name === "stigmer-server") {
|
|
102
|
+
await this.probeServer(m);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
this.persist();
|
|
106
|
+
}
|
|
107
|
+
/** Gracefully stop all components in reverse start order. */
|
|
108
|
+
async shutdown() {
|
|
109
|
+
for (let i = this.managed.length - 1; i >= 0; i -= 1) {
|
|
110
|
+
const m = this.managed[i];
|
|
111
|
+
if (m.handle === null || m.handle.hasExited())
|
|
112
|
+
continue;
|
|
113
|
+
this.log.info("stopping component", { component: m.spec.name, pid: m.state.pid });
|
|
114
|
+
await this.killAndWait(m);
|
|
115
|
+
removePidFile(m.spec.pidFile);
|
|
116
|
+
m.state.state = "stopped";
|
|
117
|
+
}
|
|
118
|
+
this.persist();
|
|
119
|
+
}
|
|
120
|
+
async probeServer(m) {
|
|
121
|
+
if (await this.probe(this.serverPort)) {
|
|
122
|
+
if (m.unhealthyCount > 0 || m.state.state === "unhealthy") {
|
|
123
|
+
m.unhealthyCount = 0;
|
|
124
|
+
m.state.state = "running";
|
|
125
|
+
m.state.last_error = undefined;
|
|
126
|
+
this.log.info("component recovered — gRPC port responding again", { component: m.spec.name });
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
m.unhealthyCount += 1;
|
|
131
|
+
this.log.warn("gRPC port not responding", { component: m.spec.name, consecutive_failures: m.unhealthyCount });
|
|
132
|
+
if (m.unhealthyCount >= MAX_UNHEALTHY_CHECKS) {
|
|
133
|
+
this.log.error("unhealthy threshold exceeded, restarting", { component: m.spec.name });
|
|
134
|
+
await this.killAndWait(m);
|
|
135
|
+
await this.tryRestart(m);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
m.state.state = "unhealthy";
|
|
139
|
+
m.state.last_error = "gRPC port not responding";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async tryRestart(m) {
|
|
143
|
+
const startedAtMs = m.state.started_at !== "" ? Date.parse(m.state.started_at) : 0;
|
|
144
|
+
if (startedAtMs > 0 && this.clock.now() - startedAtMs < RAPID_CRASH_WINDOW_MS) {
|
|
145
|
+
m.state.state = "failed";
|
|
146
|
+
m.state.last_error = "crashed immediately after start (likely a configuration or dependency error)";
|
|
147
|
+
this.log.error("component crashed too quickly, marking failed", { component: m.spec.name });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (m.state.restart_count >= MAX_RESTARTS) {
|
|
151
|
+
m.state.state = "failed";
|
|
152
|
+
m.state.last_error = `exceeded max restarts (${MAX_RESTARTS})`;
|
|
153
|
+
this.log.error("component exceeded max restarts, marking failed", { component: m.spec.name });
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
removePidFile(m.spec.pidFile);
|
|
157
|
+
m.state.restart_count += 1;
|
|
158
|
+
try {
|
|
159
|
+
this.spawn(m);
|
|
160
|
+
this.log.info("component restarted", { component: m.spec.name, restart_count: m.state.restart_count });
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
m.state.state = "failed";
|
|
164
|
+
m.state.last_error = String(err);
|
|
165
|
+
this.log.error("failed to restart component", { component: m.spec.name, error: String(err) });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Spawn (or respawn) one component, wiring exit/readiness and writing its PID.
|
|
169
|
+
spawn(m) {
|
|
170
|
+
const request = m.spec.resolve();
|
|
171
|
+
const handle = this.host.spawn(request);
|
|
172
|
+
m.handle = handle;
|
|
173
|
+
m.unhealthyCount = 0;
|
|
174
|
+
m.exitWaiter = new Promise((resolve) => {
|
|
175
|
+
handle.onExit(() => resolve());
|
|
176
|
+
});
|
|
177
|
+
handle.onReady(() => {
|
|
178
|
+
m.state.ready = true;
|
|
179
|
+
this.log.info("component announced readiness", { component: m.spec.name });
|
|
180
|
+
});
|
|
181
|
+
m.state.pid = handle.pid;
|
|
182
|
+
m.state.state = "running";
|
|
183
|
+
m.state.started_at = new Date(this.clock.now()).toISOString();
|
|
184
|
+
m.state.last_error = undefined;
|
|
185
|
+
if (request.readinessMarker !== undefined)
|
|
186
|
+
m.state.ready = false;
|
|
187
|
+
writePidFile(m.spec.pidFile, handle.pid);
|
|
188
|
+
}
|
|
189
|
+
// SIGTERM, wait for graceful exit, then SIGKILL as a last resort.
|
|
190
|
+
async killAndWait(m) {
|
|
191
|
+
if (m.handle === null || m.handle.hasExited())
|
|
192
|
+
return;
|
|
193
|
+
m.handle.kill("SIGTERM");
|
|
194
|
+
const timedOut = await this.raceTimeout(m.exitWaiter, GRACEFUL_STOP_TIMEOUT_MS);
|
|
195
|
+
if (timedOut && !m.handle.hasExited()) {
|
|
196
|
+
this.log.warn("graceful stop timed out, sending SIGKILL", { component: m.spec.name });
|
|
197
|
+
m.handle.kill("SIGKILL");
|
|
198
|
+
if (m.exitWaiter !== null)
|
|
199
|
+
await m.exitWaiter;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Resolve false if the waiter wins, true if the timeout wins.
|
|
203
|
+
async raceTimeout(waiter, ms) {
|
|
204
|
+
if (waiter === null)
|
|
205
|
+
return false;
|
|
206
|
+
const timeout = Symbol("timeout");
|
|
207
|
+
const result = await Promise.race([waiter.then(() => undefined), this.clock.sleep(ms).then(() => timeout)]);
|
|
208
|
+
return result === timeout;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=supervisor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../../../src/local/daemon/supervisor.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,0BAA0B;AAC1B,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,8CAA8C;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAe,GAAG,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGlE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK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YAAE,OAAO,KAAK,CAAC;QAClC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5G,OAAO,MAAM,KAAK,OAAO,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** How a child terminated. */
|
|
2
|
+
export interface ExitInfo {
|
|
3
|
+
code: number | null;
|
|
4
|
+
signal: NodeJS.Signals | null;
|
|
5
|
+
}
|
|
6
|
+
/** A request to launch one child process. */
|
|
7
|
+
export interface SpawnRequest {
|
|
8
|
+
command: string;
|
|
9
|
+
args: string[];
|
|
10
|
+
cwd?: string;
|
|
11
|
+
env: NodeJS.ProcessEnv;
|
|
12
|
+
/** Log file the child's stdout+stderr are appended to. */
|
|
13
|
+
logFile: string;
|
|
14
|
+
/** If set, the host watches stdout for this line and fires onReady once. */
|
|
15
|
+
readinessMarker?: string;
|
|
16
|
+
}
|
|
17
|
+
/** A live handle to a spawned child. */
|
|
18
|
+
export interface ChildHandle {
|
|
19
|
+
readonly pid: number;
|
|
20
|
+
/** True once the child has terminated (and been observed). */
|
|
21
|
+
hasExited(): boolean;
|
|
22
|
+
/** Register the exit callback (invoked once). */
|
|
23
|
+
onExit(cb: (info: ExitInfo) => void): void;
|
|
24
|
+
/** Register the readiness callback (invoked once if a marker was set). */
|
|
25
|
+
onReady(cb: () => void): void;
|
|
26
|
+
/** Signal the child's process group. */
|
|
27
|
+
kill(signal: NodeJS.Signals): void;
|
|
28
|
+
}
|
|
29
|
+
/** Spawns child processes. The real implementation pipes + tees logs; tests
|
|
30
|
+
* substitute a fake that drives exit/readiness synthetically. */
|
|
31
|
+
export interface ProcessHost {
|
|
32
|
+
spawn(request: SpawnRequest): ChildHandle;
|
|
33
|
+
}
|
|
34
|
+
/** Time source, injectable so policy tests run without real delays. */
|
|
35
|
+
export interface Clock {
|
|
36
|
+
/** Current epoch milliseconds. */
|
|
37
|
+
now(): number;
|
|
38
|
+
/** Resolve after `ms` milliseconds. */
|
|
39
|
+
sleep(ms: number): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Declarative description of one managed component. `resolve` is called lazily
|
|
43
|
+
* at (re)start time so binary resolution and env construction happen fresh on
|
|
44
|
+
* every attempt — matching the Go daemon's per-start `startFn`.
|
|
45
|
+
*/
|
|
46
|
+
export interface ComponentSpec {
|
|
47
|
+
name: string;
|
|
48
|
+
pidFile: string;
|
|
49
|
+
/** Critical components abort daemon startup if they fail to start/gate. */
|
|
50
|
+
critical: boolean;
|
|
51
|
+
/** Produce the spawn request for a (re)start. */
|
|
52
|
+
resolve(): SpawnRequest;
|
|
53
|
+
/** Optional post-spawn readiness gate (e.g. the server's gRPC port). */
|
|
54
|
+
gate?: ReadinessGate;
|
|
55
|
+
}
|
|
56
|
+
/** A post-spawn readiness check with its own deadline. */
|
|
57
|
+
export interface ReadinessGate {
|
|
58
|
+
/** Resolves when ready; rejects if the deadline passes or the child exits. */
|
|
59
|
+
wait(handle: ChildHandle): Promise<void>;
|
|
60
|
+
/** Human description for logs/errors. */
|
|
61
|
+
description: string;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/local/daemon/types.ts"],"names":[],"mappings":"AAQA,8BAA8B;AAC9B,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED,6CAA6C;AAC7C,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C9E,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Shared types for the daemon supervisor and its injectable seams.
|
|
2
|
+
//
|
|
3
|
+
// The supervisor's restart/health policy is the part that must be exhaustively
|
|
4
|
+
// testable, so every side effect it performs — spawning a process, reading the
|
|
5
|
+
// clock — goes through an interface that tests can fake. The Go daemon's policy
|
|
6
|
+
// is only reachable through a full integration run; this design makes it a pure
|
|
7
|
+
// unit.
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/local/daemon/types.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,gFAAgF;AAChF,QAAQ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Config } from "../config/config.js";
|
|
2
|
+
/** LLM settings as persisted under `backend.local.llm` (snake_case = YAML keys). */
|
|
3
|
+
export interface LlmSettings {
|
|
4
|
+
provider?: string;
|
|
5
|
+
model?: string;
|
|
6
|
+
api_key?: string;
|
|
7
|
+
base_url?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The persisted LLM settings, if any. */
|
|
10
|
+
export declare function readLlm(config: Config): LlmSettings | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Detect a provider from API keys present in the environment (Anthropic first,
|
|
13
|
+
* then OpenAI), matching the Go CLI's `DetectProviderFromAPIKeys`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function detectProviderFromEnv(env?: NodeJS.ProcessEnv): string;
|
|
16
|
+
/** Effective provider: env override > config > API-key autodetect. */
|
|
17
|
+
export declare function resolveProvider(config: Config, env?: NodeJS.ProcessEnv): string;
|
|
18
|
+
/** Effective model: env override > config > provider default. */
|
|
19
|
+
export declare function resolveModel(config: Config, env?: NodeJS.ProcessEnv): string;
|
|
20
|
+
/** Effective API key: provider-specific env var > config. */
|
|
21
|
+
export declare function resolveApiKey(config: Config, env?: NodeJS.ProcessEnv): string;
|
|
22
|
+
/** Fill in provider-appropriate defaults for a partial selection. */
|
|
23
|
+
export declare function withProviderDefaults(settings: LlmSettings): LlmSettings;
|
|
24
|
+
/**
|
|
25
|
+
* Return a copy of `config` with the LLM section replaced, preserving every
|
|
26
|
+
* other key under `backend.local`. Passing `undefined` clears the LLM section
|
|
27
|
+
* (the wizard's "skip" path).
|
|
28
|
+
*/
|
|
29
|
+
export declare function setLlm(config: Config, settings: LlmSettings | undefined): Config;
|
|
30
|
+
//# sourceMappingURL=llm-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-config.d.ts","sourceRoot":"","sources":["../../src/local/llm-config.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAwBD,0CAA0C;AAC1C,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAE/D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAIlF;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAK5F;AAED,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAKzF;AAED,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAK1F;AAED,qEAAqE;AACrE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,GAAG,WAAW,CAQvE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAQhF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Typed view over the otherwise-opaque `backend.local` config section, scoped to
|
|
2
|
+
// the LLM settings `setup` writes and `status` reads.
|
|
3
|
+
//
|
|
4
|
+
// The config module (config/config.ts) carries `backend.local` through verbatim
|
|
5
|
+
// so the TS CLI never drops fields it does not model. This module adds a *typed
|
|
6
|
+
// lens* for the one sub-tree T05 owns — `local.llm` — and ports the Go CLI's
|
|
7
|
+
// `ResolveLLM*` precedence (env override > config file > provider default) so the
|
|
8
|
+
// two CLIs agree on which provider/model is effectively in force. Writes merge
|
|
9
|
+
// into a shallow copy of `local`, preserving every sibling key (temporal,
|
|
10
|
+
// execution, …).
|
|
11
|
+
/** Default model per provider, matching the Go setup wizard's choices. */
|
|
12
|
+
const DEFAULT_MODEL = {
|
|
13
|
+
ollama: "qwen2.5-coder:7b",
|
|
14
|
+
anthropic: "claude-sonnet-4.5",
|
|
15
|
+
openai: "gpt-4",
|
|
16
|
+
};
|
|
17
|
+
/** Default base URL per provider (only Ollama needs one). */
|
|
18
|
+
const DEFAULT_BASE_URL = {
|
|
19
|
+
ollama: "http://localhost:11434",
|
|
20
|
+
};
|
|
21
|
+
function localSection(config) {
|
|
22
|
+
const local = config.backend.local;
|
|
23
|
+
return local !== null && typeof local === "object" ? local : {};
|
|
24
|
+
}
|
|
25
|
+
/** The persisted LLM settings, if any. */
|
|
26
|
+
export function readLlm(config) {
|
|
27
|
+
return localSection(config).llm;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Detect a provider from API keys present in the environment (Anthropic first,
|
|
31
|
+
* then OpenAI), matching the Go CLI's `DetectProviderFromAPIKeys`.
|
|
32
|
+
*/
|
|
33
|
+
export function detectProviderFromEnv(env = process.env) {
|
|
34
|
+
if (env.ANTHROPIC_API_KEY)
|
|
35
|
+
return "anthropic";
|
|
36
|
+
if (env.OPENAI_API_KEY)
|
|
37
|
+
return "openai";
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
/** Effective provider: env override > config > API-key autodetect. */
|
|
41
|
+
export function resolveProvider(config, env = process.env) {
|
|
42
|
+
if (env.STIGMER_LLM_PROVIDER)
|
|
43
|
+
return env.STIGMER_LLM_PROVIDER;
|
|
44
|
+
const llm = readLlm(config);
|
|
45
|
+
if (llm?.provider)
|
|
46
|
+
return llm.provider;
|
|
47
|
+
return detectProviderFromEnv(env);
|
|
48
|
+
}
|
|
49
|
+
/** Effective model: env override > config > provider default. */
|
|
50
|
+
export function resolveModel(config, env = process.env) {
|
|
51
|
+
if (env.STIGMER_LLM_MODEL)
|
|
52
|
+
return env.STIGMER_LLM_MODEL;
|
|
53
|
+
const llm = readLlm(config);
|
|
54
|
+
if (llm?.model)
|
|
55
|
+
return llm.model;
|
|
56
|
+
return DEFAULT_MODEL[resolveProvider(config, env)] ?? "";
|
|
57
|
+
}
|
|
58
|
+
/** Effective API key: provider-specific env var > config. */
|
|
59
|
+
export function resolveApiKey(config, env = process.env) {
|
|
60
|
+
const provider = resolveProvider(config, env);
|
|
61
|
+
const envKey = provider === "anthropic" ? env.ANTHROPIC_API_KEY : provider === "openai" ? env.OPENAI_API_KEY : "";
|
|
62
|
+
if (envKey)
|
|
63
|
+
return envKey;
|
|
64
|
+
return readLlm(config)?.api_key ?? "";
|
|
65
|
+
}
|
|
66
|
+
/** Fill in provider-appropriate defaults for a partial selection. */
|
|
67
|
+
export function withProviderDefaults(settings) {
|
|
68
|
+
const provider = settings.provider ?? "";
|
|
69
|
+
const out = { provider };
|
|
70
|
+
out.model = settings.model ?? DEFAULT_MODEL[provider];
|
|
71
|
+
if (settings.api_key)
|
|
72
|
+
out.api_key = settings.api_key;
|
|
73
|
+
const baseUrl = settings.base_url ?? DEFAULT_BASE_URL[provider];
|
|
74
|
+
if (baseUrl)
|
|
75
|
+
out.base_url = baseUrl;
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Return a copy of `config` with the LLM section replaced, preserving every
|
|
80
|
+
* other key under `backend.local`. Passing `undefined` clears the LLM section
|
|
81
|
+
* (the wizard's "skip" path).
|
|
82
|
+
*/
|
|
83
|
+
export function setLlm(config, settings) {
|
|
84
|
+
const local = { ...localSection(config) };
|
|
85
|
+
if (settings === undefined) {
|
|
86
|
+
delete local.llm;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
local.llm = settings;
|
|
90
|
+
}
|
|
91
|
+
return { ...config, backend: { ...config.backend, local } };
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=llm-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-config.js","sourceRoot":"","sources":["../../src/local/llm-config.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,sDAAsD;AACtD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,kFAAkF;AAClF,+EAA+E;AAC/E,0EAA0E;AAC1E,iBAAiB;AAiBjB,0EAA0E;AAC1E,MAAM,aAAa,GAA2B;IAC5C,MAAM,EAAE,kBAAkB;IAC1B,SAAS,EAAE,mBAAmB;IAC9B,MAAM,EAAE,OAAO;CAChB,CAAC;AAEF,6DAA6D;AAC7D,MAAM,gBAAgB,GAA2B;IAC/C,MAAM,EAAE,wBAAwB;CACjC,CAAC;AAEF,SAAS,YAAY,CAAC,MAAc;IAClC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CA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OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Return the last `n` non-empty-trailing lines of a file (all lines if n<=0). */
|
|
2
|
+
export declare function tailLines(file: string, n: number): string[];
|
|
3
|
+
export interface FollowHandle {
|
|
4
|
+
/** Stop polling and release resources. */
|
|
5
|
+
stop(): void;
|
|
6
|
+
}
|
|
7
|
+
export interface FollowOptions {
|
|
8
|
+
/** Poll interval; defaults to 200ms. */
|
|
9
|
+
pollMs?: number;
|
|
10
|
+
/** Start from byte 0 instead of the current end (emit existing content too). */
|
|
11
|
+
fromStart?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Stream lines appended to `file`, invoking `onLine` per complete line. Survives
|
|
15
|
+
* rotation (inode change -> reopen from 0) and truncation (size shrink -> reset
|
|
16
|
+
* to 0). Returns a handle whose `stop()` ends the stream.
|
|
17
|
+
*/
|
|
18
|
+
export declare function followFile(file: string, onLine: (line: string) => void, options?: FollowOptions): FollowHandle;
|
|
19
|
+
//# sourceMappingURL=tail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../../../src/local/logs/tail.ts"],"names":[],"mappings":"AAYA,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAU3D;AAED,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,IAAI,IAAI,IAAI,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAAE,OAAO,GAAE,aAAkB,GAAG,YAAY,CAyDlH"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Log tailing + following primitives, robust to the daemon's log rotation.
|
|
2
|
+
//
|
|
3
|
+
// Logs are bounded (rotated at daemon start), so `tailLines` reads the whole
|
|
4
|
+
// file and slices — far simpler and less bug-prone than fd seeking, with no
|
|
5
|
+
// meaningful cost at these sizes. `followFile` is a poll-based `tail -F`:
|
|
6
|
+
// polling `stat` rather than `fs.watch` is deliberate, because `fs.watch`'s
|
|
7
|
+
// rename/rotation semantics differ across platforms and silently miss events.
|
|
8
|
+
// Rotation and truncation are detected by inode change and size shrink
|
|
9
|
+
// respectively, and the reader reopens from the start so no lines are lost.
|
|
10
|
+
import { closeSync, openSync, readFileSync, readSync, statSync } from "node:fs";
|
|
11
|
+
/** Return the last `n` non-empty-trailing lines of a file (all lines if n<=0). */
|
|
12
|
+
export function tailLines(file, n) {
|
|
13
|
+
let content;
|
|
14
|
+
try {
|
|
15
|
+
content = readFileSync(file, "utf8");
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const lines = content.split("\n");
|
|
21
|
+
if (lines.length > 0 && lines[lines.length - 1] === "")
|
|
22
|
+
lines.pop();
|
|
23
|
+
return n <= 0 ? lines : lines.slice(-n);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Stream lines appended to `file`, invoking `onLine` per complete line. Survives
|
|
27
|
+
* rotation (inode change -> reopen from 0) and truncation (size shrink -> reset
|
|
28
|
+
* to 0). Returns a handle whose `stop()` ends the stream.
|
|
29
|
+
*/
|
|
30
|
+
export function followFile(file, onLine, options = {}) {
|
|
31
|
+
const pollMs = options.pollMs ?? 200;
|
|
32
|
+
let inode = -1;
|
|
33
|
+
let offset = 0;
|
|
34
|
+
let buffer = "";
|
|
35
|
+
let started = false;
|
|
36
|
+
const drain = () => {
|
|
37
|
+
let newline;
|
|
38
|
+
while ((newline = buffer.indexOf("\n")) >= 0) {
|
|
39
|
+
onLine(buffer.slice(0, newline));
|
|
40
|
+
buffer = buffer.slice(newline + 1);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const tick = () => {
|
|
44
|
+
let stat;
|
|
45
|
+
try {
|
|
46
|
+
stat = statSync(file);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return; // file not created yet, or briefly gone mid-rotation
|
|
50
|
+
}
|
|
51
|
+
if (stat.ino !== inode) {
|
|
52
|
+
// First sight of the file, or it was rotated out from under us.
|
|
53
|
+
inode = stat.ino;
|
|
54
|
+
offset = started || options.fromStart === true ? 0 : stat.size;
|
|
55
|
+
buffer = "";
|
|
56
|
+
}
|
|
57
|
+
else if (stat.size < offset) {
|
|
58
|
+
offset = 0; // truncated in place
|
|
59
|
+
buffer = "";
|
|
60
|
+
}
|
|
61
|
+
started = true;
|
|
62
|
+
if (stat.size <= offset)
|
|
63
|
+
return;
|
|
64
|
+
const length = stat.size - offset;
|
|
65
|
+
const chunk = Buffer.alloc(length);
|
|
66
|
+
const fd = openSync(file, "r");
|
|
67
|
+
try {
|
|
68
|
+
readSync(fd, chunk, 0, length, offset);
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
closeSync(fd);
|
|
72
|
+
}
|
|
73
|
+
offset = stat.size;
|
|
74
|
+
buffer += chunk.toString("utf8");
|
|
75
|
+
drain();
|
|
76
|
+
};
|
|
77
|
+
tick();
|
|
78
|
+
const timer = setInterval(tick, pollMs);
|
|
79
|
+
timer.unref?.();
|
|
80
|
+
return {
|
|
81
|
+
stop() {
|
|
82
|
+
clearInterval(timer);
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=tail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail.js","sourceRoot":"","s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