iosm-cli 0.1.0
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/CHANGELOG.md +55 -0
- package/LICENSE +21 -0
- package/README.md +650 -0
- package/dist/cli/args.d.ts +54 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +331 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +79 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +92 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +34 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +88 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +262 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-profiles.d.ts +29 -0
- package/dist/core/agent-profiles.d.ts.map +1 -0
- package/dist/core/agent-profiles.js +86 -0
- package/dist/core/agent-profiles.js.map +1 -0
- package/dist/core/agent-session.d.ts +688 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +3112 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/agent-teams.d.ts +41 -0
- package/dist/core/agent-teams.d.ts.map +1 -0
- package/dist/core/agent-teams.js +90 -0
- package/dist/core/agent-teams.js.map +1 -0
- package/dist/core/ask-user-tool.d.ts +22 -0
- package/dist/core/ask-user-tool.d.ts.map +1 -0
- package/dist/core/ask-user-tool.js +115 -0
- package/dist/core/ask-user-tool.js.map +1 -0
- package/dist/core/auth-storage.d.ts +133 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +391 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +49 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +213 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +86 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +242 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +121 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +610 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +35 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +138 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +71 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +34 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +222 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +971 -0
- package/dist/core/export-html/template.html +54 -0
- package/dist/core/export-html/template.js +1590 -0
- package/dist/core/export-html/tool-renderer.d.ts +35 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +63 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +6 -0
- package/dist/core/extensions/index.d.ts +11 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +25 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +447 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +146 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +652 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1074 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +35 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +27 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +102 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +32 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +134 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/hooks.d.ts +53 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +332 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +55 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +157 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/mcp/cli.d.ts +27 -0
- package/dist/core/mcp/cli.d.ts.map +1 -0
- package/dist/core/mcp/cli.js +275 -0
- package/dist/core/mcp/cli.js.map +1 -0
- package/dist/core/mcp/config.d.ts +11 -0
- package/dist/core/mcp/config.d.ts.map +1 -0
- package/dist/core/mcp/config.js +310 -0
- package/dist/core/mcp/config.js.map +1 -0
- package/dist/core/mcp/index.d.ts +5 -0
- package/dist/core/mcp/index.d.ts.map +1 -0
- package/dist/core/mcp/index.js +4 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/runtime.d.ts +42 -0
- package/dist/core/mcp/runtime.d.ts.map +1 -0
- package/dist/core/mcp/runtime.js +387 -0
- package/dist/core/mcp/runtime.js.map +1 -0
- package/dist/core/mcp/types.d.ts +76 -0
- package/dist/core/mcp/types.d.ts.map +1 -0
- package/dist/core/mcp/types.js +2 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/memory.d.ts +27 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +203 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/messages.d.ts +84 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +141 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +115 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +549 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +104 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +448 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/package-manager.d.ts +156 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +1465 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/parallel-task-agent.d.ts +19 -0
- package/dist/core/parallel-task-agent.d.ts.map +1 -0
- package/dist/core/parallel-task-agent.js +482 -0
- package/dist/core/parallel-task-agent.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +50 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +251 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/qwen-cli-provider.d.ts +10 -0
- package/dist/core/qwen-cli-provider.d.ts.map +1 -0
- package/dist/core/qwen-cli-provider.js +271 -0
- package/dist/core/qwen-cli-provider.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +17 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +60 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +195 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +820 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/sdk.d.ts +106 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +460 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-manager.d.ts +323 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1094 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +243 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +691 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +58 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +364 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +64 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/subagent-runs.d.ts +16 -0
- package/dist/core/subagent-runs.d.ts.map +1 -0
- package/dist/core/subagent-runs.js +70 -0
- package/dist/core/subagent-runs.js.map +1 -0
- package/dist/core/subagents.d.ts +45 -0
- package/dist/core/subagents.d.ts.map +1 -0
- package/dist/core/subagents.js +467 -0
- package/dist/core/subagents.js.map +1 -0
- package/dist/core/system-prompt.d.ts +28 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +196 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/task-plan.d.ts +32 -0
- package/dist/core/task-plan.d.ts.map +1 -0
- package/dist/core/task-plan.js +155 -0
- package/dist/core/task-plan.js.map +1 -0
- package/dist/core/timings.d.ts +7 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +26 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +58 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +275 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +63 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +243 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +42 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +158 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/find.d.ts +39 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +219 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +45 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +254 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/ignore-filter.d.ts +5 -0
- package/dist/core/tools/ignore-filter.d.ts.map +1 -0
- package/dist/core/tools/ignore-filter.js +97 -0
- package/dist/core/tools/ignore-filter.js.map +1 -0
- package/dist/core/tools/index.d.ts +97 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +78 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +46 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +136 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +8 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +81 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/permissions.d.ts +8 -0
- package/dist/core/tools/permissions.d.ts.map +1 -0
- package/dist/core/tools/permissions.js +2 -0
- package/dist/core/tools/permissions.js.map +1 -0
- package/dist/core/tools/read.d.ts +39 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +166 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/task.d.ts +109 -0
- package/dist/core/tools/task.d.ts.map +1 -0
- package/dist/core/tools/task.js +1065 -0
- package/dist/core/tools/task.js.map +1 -0
- package/dist/core/tools/todo.d.ts +42 -0
- package/dist/core/tools/todo.d.ts.map +1 -0
- package/dist/core/tools/todo.js +159 -0
- package/dist/core/tools/todo.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +205 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +32 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +90 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/iosm/agent-verification.d.ts +16 -0
- package/dist/iosm/agent-verification.d.ts.map +1 -0
- package/dist/iosm/agent-verification.js +138 -0
- package/dist/iosm/agent-verification.js.map +1 -0
- package/dist/iosm/automation.d.ts +40 -0
- package/dist/iosm/automation.d.ts.map +1 -0
- package/dist/iosm/automation.js +76 -0
- package/dist/iosm/automation.js.map +1 -0
- package/dist/iosm/config.d.ts +151 -0
- package/dist/iosm/config.d.ts.map +1 -0
- package/dist/iosm/config.js +323 -0
- package/dist/iosm/config.js.map +1 -0
- package/dist/iosm/context-loader.d.ts +12 -0
- package/dist/iosm/context-loader.d.ts.map +1 -0
- package/dist/iosm/context-loader.js +50 -0
- package/dist/iosm/context-loader.js.map +1 -0
- package/dist/iosm/cycle.d.ts +51 -0
- package/dist/iosm/cycle.d.ts.map +1 -0
- package/dist/iosm/cycle.js +861 -0
- package/dist/iosm/cycle.js.map +1 -0
- package/dist/iosm/guide.d.ts +31 -0
- package/dist/iosm/guide.d.ts.map +1 -0
- package/dist/iosm/guide.js +101 -0
- package/dist/iosm/guide.js.map +1 -0
- package/dist/iosm/index.d.ts +12 -0
- package/dist/iosm/index.d.ts.map +1 -0
- package/dist/iosm/index.js +11 -0
- package/dist/iosm/index.js.map +1 -0
- package/dist/iosm/init.d.ts +58 -0
- package/dist/iosm/init.d.ts.map +1 -0
- package/dist/iosm/init.js +1221 -0
- package/dist/iosm/init.js.map +1 -0
- package/dist/iosm/metrics.d.ts +23 -0
- package/dist/iosm/metrics.d.ts.map +1 -0
- package/dist/iosm/metrics.js +336 -0
- package/dist/iosm/metrics.js.map +1 -0
- package/dist/iosm/paths.d.ts +24 -0
- package/dist/iosm/paths.d.ts.map +1 -0
- package/dist/iosm/paths.js +77 -0
- package/dist/iosm/paths.js.map +1 -0
- package/dist/iosm/runtime-context.d.ts +20 -0
- package/dist/iosm/runtime-context.d.ts.map +1 -0
- package/dist/iosm/runtime-context.js +170 -0
- package/dist/iosm/runtime-context.js.map +1 -0
- package/dist/iosm/types.d.ts +151 -0
- package/dist/iosm/types.d.ts.map +1 -0
- package/dist/iosm/types.js +3 -0
- package/dist/iosm/types.js.map +1 -0
- package/dist/main.d.ts +8 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +1478 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +261 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +9 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +329 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/ascii-logo.d.ts +11 -0
- package/dist/modes/interactive/components/ascii-logo.d.ts.map +1 -0
- package/dist/modes/interactive/components/ascii-logo.js +25 -0
- package/dist/modes/interactive/components/ascii-logo.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +16 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +92 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +36 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +170 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +48 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +42 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +43 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +71 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +470 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +28 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +63 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +74 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +138 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/decrypt-loader.d.ts +25 -0
- package/dist/modes/interactive/components/decrypt-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/decrypt-loader.js +102 -0
- package/dist/modes/interactive/components/decrypt-loader.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +20 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +20 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +105 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +55 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +24 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +71 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +39 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +285 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +33 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +34 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +50 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +85 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +42 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +139 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/mcp-selector.d.ts +31 -0
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/mcp-selector.js +171 -0
- package/dist/modes/interactive/components/mcp-selector.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +51 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +292 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +134 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +271 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +839 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +60 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +311 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +34 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +45 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/subagent-message.d.ts +91 -0
- package/dist/modes/interactive/components/subagent-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/subagent-message.js +306 -0
- package/dist/modes/interactive/components/subagent-message.js.map +1 -0
- package/dist/modes/interactive/components/task-plan-message.d.ts +12 -0
- package/dist/modes/interactive/components/task-plan-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-plan-message.js +61 -0
- package/dist/modes/interactive/components/task-plan-message.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +44 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +46 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +78 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +880 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +70 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +921 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +110 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +27 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +453 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +8669 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +78 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +944 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +101 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +217 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +404 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +580 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +409 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/utils/changelog.d.ts +21 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +87 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +162 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +7 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +14 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +67 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +163 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/image-convert.d.ts +9 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +35 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-resize.d.ts +36 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +181 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +26 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/shell.d.ts +26 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +186 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +251 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/docs/README.md +32 -0
- package/docs/cli-reference.md +342 -0
- package/docs/configuration.md +301 -0
- package/docs/development-and-testing.md +295 -0
- package/docs/extensions-packages-themes.md +415 -0
- package/docs/getting-started.md +246 -0
- package/docs/interactive-mode.md +272 -0
- package/docs/iosm-init-and-cycles.md +355 -0
- package/docs/orchestration-and-subagents.md +273 -0
- package/docs/rpc-json-sdk.md +353 -0
- package/docs/sessions-traces-export.md +260 -0
- package/examples/README.md +120 -0
- package/examples/extensions/README.md +306 -0
- package/examples/extensions/antigravity-image-gen.ts +415 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/built-in-tool-renderer.ts +246 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +114 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +349 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/custom-provider-qwen-cli/index.ts +345 -0
- package/examples/extensions/custom-provider-qwen-cli/package.json +16 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/handoff.ts +150 -0
- package/examples/extensions/hello.ts +25 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +881 -0
- package/examples/extensions/overlay-test.ts +150 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +340 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +398 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/qna.ts +119 -0
- package/examples/extensions/question.ts +264 -0
- package/examples/extensions/questionnaire.ts +427 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +124 -0
- package/examples/extensions/sandbox/index.ts +318 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +40 -0
- package/examples/extensions/subagent/README.md +172 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +964 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +195 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +299 -0
- package/examples/extensions/tool-override.ts +143 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +40 -0
- package/examples/extensions/truncated-tool.ts +192 -0
- package/examples/extensions/widget-placement.ts +17 -0
- package/examples/extensions/with-deps/index.ts +36 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +22 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +55 -0
- package/examples/sdk/04-skills.ts +46 -0
- package/examples/sdk/05-tools.ts +56 -0
- package/examples/sdk/06-extensions.ts +88 -0
- package/examples/sdk/07-context-files.ts +40 -0
- package/examples/sdk/08-prompt-templates.ts +47 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +48 -0
- package/examples/sdk/10-settings.ts +51 -0
- package/examples/sdk/11-sessions.ts +48 -0
- package/examples/sdk/12-full-control.ts +82 -0
- package/examples/sdk/README.md +337 -0
- package/examples/tsconfig.json +3 -0
- package/package.json +107 -0
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { loadIosmConfig, resolveIosmRootDir } from "./config.js";
|
|
4
|
+
import { assessDeclineCoverage, buildCycleBudget, calculateDecisionConfidence, calculateIosmIndex, calculateIosmMetricsFromRawMeasurements, calculateMetricDeltas, createMetricRecord, hasCompleteNumericMetricRecord, hasCompleteTierMetricRecord, IOSM_METRICS, mergeMetricValues, validateGuardrails, } from "./metrics.js";
|
|
5
|
+
import { getIosmBaselineReportPath, getIosmCycleDir, getIosmCycleReportPath, getIosmCyclesDir, getIosmHypothesesPath, getIosmMetricsHistoryPath, getIosmPhaseReportPath, getIosmPhaseReportsDir, } from "./paths.js";
|
|
6
|
+
import { IOSM_PHASES } from "./types.js";
|
|
7
|
+
const IOSM_PHASE_GATES = {
|
|
8
|
+
improve: "gate_I",
|
|
9
|
+
optimize: "gate_O",
|
|
10
|
+
shrink: "gate_S",
|
|
11
|
+
modularize: "gate_M",
|
|
12
|
+
};
|
|
13
|
+
function isPlainObject(value) {
|
|
14
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
function asString(value) {
|
|
17
|
+
return typeof value === "string" ? value : undefined;
|
|
18
|
+
}
|
|
19
|
+
function asNumber(value) {
|
|
20
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
21
|
+
}
|
|
22
|
+
function asBoolean(value) {
|
|
23
|
+
return typeof value === "boolean" ? value : undefined;
|
|
24
|
+
}
|
|
25
|
+
function asStringArray(value) {
|
|
26
|
+
if (!Array.isArray(value)) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
return value.filter((entry) => typeof entry === "string");
|
|
30
|
+
}
|
|
31
|
+
function jsonWrite(filePath, value) {
|
|
32
|
+
writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
33
|
+
}
|
|
34
|
+
function readJson(filePath) {
|
|
35
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
36
|
+
}
|
|
37
|
+
function formatLocalDate(now) {
|
|
38
|
+
const year = now.getFullYear();
|
|
39
|
+
const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
40
|
+
const day = String(now.getDate()).padStart(2, "0");
|
|
41
|
+
return `${year}-${month}-${day}`;
|
|
42
|
+
}
|
|
43
|
+
function createObservationWindow(now) {
|
|
44
|
+
const date = formatLocalDate(now);
|
|
45
|
+
return `${date}/${date}`;
|
|
46
|
+
}
|
|
47
|
+
function slugify(value) {
|
|
48
|
+
return value
|
|
49
|
+
.toLowerCase()
|
|
50
|
+
.trim()
|
|
51
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
52
|
+
.replace(/^-+|-+$/g, "")
|
|
53
|
+
.slice(0, 48);
|
|
54
|
+
}
|
|
55
|
+
function countScopeItems(scope) {
|
|
56
|
+
return scope.modules.length + scope.services.length + scope.domains.length + scope.contracts.length;
|
|
57
|
+
}
|
|
58
|
+
function estimateExpectedChangeSurface(hypotheses, cycleScope) {
|
|
59
|
+
const scopeSize = countScopeItems(cycleScope);
|
|
60
|
+
return scopeSize > 0 ? scopeSize : Math.max(hypotheses.length, 1);
|
|
61
|
+
}
|
|
62
|
+
function nextCycleId(rootDir) {
|
|
63
|
+
const today = formatLocalDate(new Date());
|
|
64
|
+
const prefix = `iosm-${today}-`;
|
|
65
|
+
const cycleDir = getIosmCyclesDir(rootDir);
|
|
66
|
+
if (!existsSync(cycleDir)) {
|
|
67
|
+
return `${prefix}001`;
|
|
68
|
+
}
|
|
69
|
+
const suffixes = readdirSync(cycleDir)
|
|
70
|
+
.filter((entry) => entry.startsWith(prefix))
|
|
71
|
+
.map((entry) => Number.parseInt(entry.slice(prefix.length), 10))
|
|
72
|
+
.filter((value) => Number.isFinite(value));
|
|
73
|
+
const nextIndex = suffixes.length === 0 ? 1 : Math.max(...suffixes) + 1;
|
|
74
|
+
return `${prefix}${String(nextIndex).padStart(3, "0")}`;
|
|
75
|
+
}
|
|
76
|
+
function createCycleScopeTemplate() {
|
|
77
|
+
return {
|
|
78
|
+
modules: [],
|
|
79
|
+
services: [],
|
|
80
|
+
domains: [],
|
|
81
|
+
contracts: [],
|
|
82
|
+
rationale: "Fill in cycle scope before phase execution.",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function normalizeCycleScope(value) {
|
|
86
|
+
const object = isPlainObject(value) ? value : {};
|
|
87
|
+
return {
|
|
88
|
+
modules: asStringArray(object.modules),
|
|
89
|
+
services: asStringArray(object.services),
|
|
90
|
+
domains: asStringArray(object.domains),
|
|
91
|
+
contracts: asStringArray(object.contracts),
|
|
92
|
+
rationale: asString(object.rationale) ?? "",
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function normalizeMetricNumbers(value, fallback) {
|
|
96
|
+
const object = isPlainObject(value) ? value : {};
|
|
97
|
+
return createMetricRecord((metric) => asNumber(object[metric]) ?? fallback);
|
|
98
|
+
}
|
|
99
|
+
function normalizeMetricTiers(value) {
|
|
100
|
+
const object = isPlainObject(value) ? value : {};
|
|
101
|
+
return createMetricRecord((metric) => {
|
|
102
|
+
const tier = asString(object[metric]);
|
|
103
|
+
return tier === "A" || tier === "B" || tier === "C" ? tier : null;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function normalizeMetricBooleans(value, fallback) {
|
|
107
|
+
const object = isPlainObject(value) ? value : {};
|
|
108
|
+
return createMetricRecord((metric) => asBoolean(object[metric]) ?? fallback);
|
|
109
|
+
}
|
|
110
|
+
function createCycleCapacity(goals, cycleScope, hypotheses, config) {
|
|
111
|
+
const goalCount = goals.length;
|
|
112
|
+
const scopeSize = countScopeItems(cycleScope);
|
|
113
|
+
const expectedChangeSurface = estimateExpectedChangeSurface(hypotheses, cycleScope);
|
|
114
|
+
return {
|
|
115
|
+
goal_count: goalCount,
|
|
116
|
+
scope_size: scopeSize,
|
|
117
|
+
expected_change_surface: expectedChangeSurface,
|
|
118
|
+
pass: goalCount <= config.max_goals &&
|
|
119
|
+
scopeSize <= config.max_scope_items &&
|
|
120
|
+
expectedChangeSurface <= config.max_expected_change_surface,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function createHypotheses(goals, config) {
|
|
124
|
+
return goals.map((goal, index) => {
|
|
125
|
+
const slug = slugify(goal) || `goal-${index + 1}`;
|
|
126
|
+
return {
|
|
127
|
+
id: `hyp-${slug}-${String(index + 1).padStart(3, "0")}`,
|
|
128
|
+
goal_id: slug,
|
|
129
|
+
owner: "unassigned",
|
|
130
|
+
statement: `If ${goal.toLowerCase()}, the target metrics should improve without violating guardrails.`,
|
|
131
|
+
expected_positive_delta: {},
|
|
132
|
+
allowed_negative_delta: { ...config.iosm.guardrails.max_negative_delta },
|
|
133
|
+
expected_business_signal: {
|
|
134
|
+
metric: "",
|
|
135
|
+
direction: "up",
|
|
136
|
+
},
|
|
137
|
+
validation: {
|
|
138
|
+
method: "fill-in",
|
|
139
|
+
window: "fill-in",
|
|
140
|
+
},
|
|
141
|
+
rollback_trigger: [],
|
|
142
|
+
confidence: config.iosm.planning.min_confidence,
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function buildHypothesisInteractions(hypotheses) {
|
|
147
|
+
const seenGoalIds = new Set();
|
|
148
|
+
const conflicts = [];
|
|
149
|
+
for (const hypothesis of hypotheses) {
|
|
150
|
+
if (seenGoalIds.has(hypothesis.goal_id)) {
|
|
151
|
+
conflicts.push({
|
|
152
|
+
type: "duplicate_goal_id",
|
|
153
|
+
goal_id: hypothesis.goal_id,
|
|
154
|
+
hypothesis_id: hypothesis.id,
|
|
155
|
+
});
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
seenGoalIds.add(hypothesis.goal_id);
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
pass: conflicts.length === 0,
|
|
162
|
+
conflicts,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function createPhaseReport(phase) {
|
|
166
|
+
return {
|
|
167
|
+
phase,
|
|
168
|
+
gate: IOSM_PHASE_GATES[phase],
|
|
169
|
+
status: "pending",
|
|
170
|
+
pass: null,
|
|
171
|
+
inputs: [],
|
|
172
|
+
actions_taken: [],
|
|
173
|
+
outputs: [],
|
|
174
|
+
linked_hypotheses: [],
|
|
175
|
+
gate_measurements: {},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function createPhasePointers(cycleId, rootDir) {
|
|
179
|
+
return Object.fromEntries(IOSM_PHASES.map((phase) => [
|
|
180
|
+
phase,
|
|
181
|
+
{
|
|
182
|
+
path: getIosmPhaseReportPath(cycleId, phase, rootDir),
|
|
183
|
+
gate: IOSM_PHASE_GATES[phase],
|
|
184
|
+
status: "pending",
|
|
185
|
+
pass: null,
|
|
186
|
+
},
|
|
187
|
+
]));
|
|
188
|
+
}
|
|
189
|
+
function createGateResults() {
|
|
190
|
+
return {
|
|
191
|
+
gate_I: { pass: null, waived: false, status: "pending" },
|
|
192
|
+
gate_O: { pass: null, waived: false, status: "pending" },
|
|
193
|
+
gate_S: { pass: null, waived: false, status: "pending" },
|
|
194
|
+
gate_M: { pass: null, waived: false, status: "pending" },
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function createBaselineReport(rootDir, cycleId, config, cycleScope) {
|
|
198
|
+
return {
|
|
199
|
+
cycle_id: cycleId,
|
|
200
|
+
captured_at: new Date().toISOString(),
|
|
201
|
+
system: config.iosm.metadata.system_name || basename(rootDir),
|
|
202
|
+
scope: config.iosm.metadata.scope,
|
|
203
|
+
delivery_boundary: config.iosm.metadata.delivery_boundary,
|
|
204
|
+
cycle_scope: cycleScope,
|
|
205
|
+
baseline_metrics: {
|
|
206
|
+
values: createMetricRecord(() => null),
|
|
207
|
+
raw_measurements: {},
|
|
208
|
+
},
|
|
209
|
+
source_systems: [config.iosm.metadata.system_name],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function createCycleReport(rootDir, cycleId, goals, hypotheses, config) {
|
|
213
|
+
const cycleScope = createCycleScopeTemplate();
|
|
214
|
+
const cycleCapacity = createCycleCapacity(goals, cycleScope, hypotheses, config.iosm.cycle_capacity);
|
|
215
|
+
const hypothesisInteractions = buildHypothesisInteractions(hypotheses);
|
|
216
|
+
const effectiveBudget = buildCycleBudget(config.iosm.guardrails.max_negative_delta, hypotheses);
|
|
217
|
+
return {
|
|
218
|
+
cycle_id: cycleId,
|
|
219
|
+
status: "planned",
|
|
220
|
+
system: config.iosm.metadata.system_name || basename(rootDir),
|
|
221
|
+
scope: config.iosm.metadata.scope,
|
|
222
|
+
criticality_profile: config.iosm.metadata.criticality_profile,
|
|
223
|
+
delivery_boundary: config.iosm.metadata.delivery_boundary,
|
|
224
|
+
cycle_scope: cycleScope,
|
|
225
|
+
cycle_capacity: cycleCapacity,
|
|
226
|
+
window: createObservationWindow(new Date()),
|
|
227
|
+
goals,
|
|
228
|
+
hypotheses: hypotheses.map((hypothesis) => ({ ...hypothesis, pass: null, notes: [] })),
|
|
229
|
+
hypothesis_interactions: hypothesisInteractions,
|
|
230
|
+
phase_reports: createPhasePointers(cycleId, rootDir),
|
|
231
|
+
gates: createGateResults(),
|
|
232
|
+
metrics: createMetricRecord(() => null),
|
|
233
|
+
metric_confidences: createMetricRecord(() => null),
|
|
234
|
+
metric_tiers: createMetricRecord(() => null),
|
|
235
|
+
raw_measurements: {},
|
|
236
|
+
guardrails: {
|
|
237
|
+
pass: null,
|
|
238
|
+
effective_budget: effectiveBudget,
|
|
239
|
+
violations: [],
|
|
240
|
+
},
|
|
241
|
+
metric_deltas: createMetricRecord(() => null),
|
|
242
|
+
decline_coverage: createMetricRecord(() => true),
|
|
243
|
+
iosm_index: null,
|
|
244
|
+
decision_confidence: null,
|
|
245
|
+
waivers: [],
|
|
246
|
+
automation_actors: [{ type: "agent", role: "analyst", identity: "iosm-cli" }],
|
|
247
|
+
approval_path: [],
|
|
248
|
+
anti_patterns: [],
|
|
249
|
+
learning_artifacts: [],
|
|
250
|
+
incomplete: true,
|
|
251
|
+
decision: "CONTINUE",
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function writeScaffoldFile(filePath, value, force) {
|
|
255
|
+
if (existsSync(filePath) && !force) {
|
|
256
|
+
throw new Error(`Refusing to overwrite existing file: ${filePath}. Use --force to replace it.`);
|
|
257
|
+
}
|
|
258
|
+
jsonWrite(filePath, value);
|
|
259
|
+
}
|
|
260
|
+
function parseExistingHypothesisState(value) {
|
|
261
|
+
const result = new Map();
|
|
262
|
+
if (!Array.isArray(value)) {
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
for (const entry of value) {
|
|
266
|
+
if (!isPlainObject(entry)) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const id = asString(entry.id);
|
|
270
|
+
if (!id) {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
const pass = entry.pass === null || typeof entry.pass === "boolean" ? entry.pass : null;
|
|
274
|
+
result.set(id, {
|
|
275
|
+
pass,
|
|
276
|
+
notes: asStringArray(entry.notes),
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
function normalizeHypotheses(reportHypotheses, hypothesisCards) {
|
|
282
|
+
const existingState = parseExistingHypothesisState(reportHypotheses);
|
|
283
|
+
return hypothesisCards.map((hypothesis) => {
|
|
284
|
+
const state = existingState.get(hypothesis.id);
|
|
285
|
+
return {
|
|
286
|
+
...hypothesis,
|
|
287
|
+
pass: state?.pass ?? null,
|
|
288
|
+
notes: state?.notes ?? [],
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function normalizePhaseReport(value, phase) {
|
|
293
|
+
const object = isPlainObject(value) ? value : {};
|
|
294
|
+
return {
|
|
295
|
+
phase,
|
|
296
|
+
gate: asString(object.gate) ?? IOSM_PHASE_GATES[phase],
|
|
297
|
+
status: asString(object.status) === "passed" ||
|
|
298
|
+
asString(object.status) === "failed" ||
|
|
299
|
+
asString(object.status) === "waived"
|
|
300
|
+
? asString(object.status)
|
|
301
|
+
: "pending",
|
|
302
|
+
pass: object.pass === null || typeof object.pass === "boolean" ? object.pass : null,
|
|
303
|
+
inputs: asStringArray(object.inputs),
|
|
304
|
+
actions_taken: asStringArray(object.actions_taken),
|
|
305
|
+
outputs: asStringArray(object.outputs),
|
|
306
|
+
linked_hypotheses: asStringArray(object.linked_hypotheses),
|
|
307
|
+
gate_measurements: isPlainObject(object.gate_measurements) ? object.gate_measurements : {},
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function loadPhaseReports(rootDir, cycleId) {
|
|
311
|
+
return Object.fromEntries(IOSM_PHASES.map((phase) => {
|
|
312
|
+
const path = getIosmPhaseReportPath(cycleId, phase, rootDir);
|
|
313
|
+
if (!existsSync(path)) {
|
|
314
|
+
return [phase, createPhaseReport(phase)];
|
|
315
|
+
}
|
|
316
|
+
return [phase, normalizePhaseReport(readJson(path), phase)];
|
|
317
|
+
}));
|
|
318
|
+
}
|
|
319
|
+
function deriveGateResults(phaseReports, existingGates) {
|
|
320
|
+
const object = isPlainObject(existingGates) ? existingGates : {};
|
|
321
|
+
const results = createGateResults();
|
|
322
|
+
for (const phase of IOSM_PHASES) {
|
|
323
|
+
const gate = IOSM_PHASE_GATES[phase];
|
|
324
|
+
const existing = isPlainObject(object[gate]) ? object[gate] : {};
|
|
325
|
+
const phaseReport = phaseReports[phase];
|
|
326
|
+
results[gate] = {
|
|
327
|
+
pass: phaseReport.pass,
|
|
328
|
+
waived: asBoolean(existing.waived) ?? phaseReport.status === "waived",
|
|
329
|
+
status: phaseReport.status,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
return results;
|
|
333
|
+
}
|
|
334
|
+
function derivePhasePointers(rootDir, cycleId, phaseReports) {
|
|
335
|
+
return Object.fromEntries(IOSM_PHASES.map((phase) => [
|
|
336
|
+
phase,
|
|
337
|
+
{
|
|
338
|
+
path: getIosmPhaseReportPath(cycleId, phase, rootDir),
|
|
339
|
+
gate: IOSM_PHASE_GATES[phase],
|
|
340
|
+
status: phaseReports[phase].status,
|
|
341
|
+
pass: phaseReports[phase].pass,
|
|
342
|
+
},
|
|
343
|
+
]));
|
|
344
|
+
}
|
|
345
|
+
function loadBaselineMetrics(rootDir, cycleId, config) {
|
|
346
|
+
const path = getIosmBaselineReportPath(cycleId, rootDir);
|
|
347
|
+
if (!existsSync(path)) {
|
|
348
|
+
return createMetricRecord(() => null);
|
|
349
|
+
}
|
|
350
|
+
const baseline = readJson(path);
|
|
351
|
+
const storedMetrics = normalizeMetricNumbers(baseline.baseline_metrics?.values, null);
|
|
352
|
+
const computedMetrics = calculateIosmMetricsFromRawMeasurements(baseline.baseline_metrics?.raw_measurements ?? {}, config);
|
|
353
|
+
return mergeMetricValues(storedMetrics, computedMetrics);
|
|
354
|
+
}
|
|
355
|
+
function hasBlockingFailure(report) {
|
|
356
|
+
return Object.values(report.gates).some((gate) => gate.pass === false && !gate.waived);
|
|
357
|
+
}
|
|
358
|
+
function hasActiveBlockingWaivers(waivers) {
|
|
359
|
+
return waivers.some((waiver) => {
|
|
360
|
+
if (!isPlainObject(waiver)) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
const status = asString(waiver.status);
|
|
364
|
+
if (!status) {
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
return status !== "expired" && status !== "closed" && status !== "resolved";
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
function hasActiveBlockingWaiver(report) {
|
|
371
|
+
return hasActiveBlockingWaivers(report.waivers);
|
|
372
|
+
}
|
|
373
|
+
function metricFloorsMet(metrics, stabilization) {
|
|
374
|
+
for (const metric of IOSM_METRICS) {
|
|
375
|
+
if (metrics[metric] < stabilization.global_metric_floor) {
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
const specificFloor = stabilization.metric_floors[metric];
|
|
379
|
+
if (specificFloor !== undefined && metrics[metric] < specificFloor) {
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return true;
|
|
384
|
+
}
|
|
385
|
+
function evidenceThresholdsMet(confidences, minimums) {
|
|
386
|
+
return IOSM_METRICS.every((metric) => confidences[metric] >= minimums[metric]);
|
|
387
|
+
}
|
|
388
|
+
function hasTierAWindow(entries, metrics) {
|
|
389
|
+
return entries.some((entry) => metrics.every((metric) => entry.metric_tiers[metric] === "A"));
|
|
390
|
+
}
|
|
391
|
+
function hasExcessUnexplainedDrift(entries, maxConsecutiveDeclines) {
|
|
392
|
+
for (const metric of IOSM_METRICS) {
|
|
393
|
+
let streak = 0;
|
|
394
|
+
for (let index = entries.length - 1; index >= 0; index--) {
|
|
395
|
+
const entry = entries[index];
|
|
396
|
+
if (entry.metric_deltas[metric] < 0 && !entry.decline_coverage[metric]) {
|
|
397
|
+
streak += 1;
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
if (streak > maxConsecutiveDeclines) {
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
function readMetricsHistoryEntries(rootDir) {
|
|
409
|
+
const historyPath = getIosmMetricsHistoryPath(rootDir);
|
|
410
|
+
if (!existsSync(historyPath)) {
|
|
411
|
+
return [];
|
|
412
|
+
}
|
|
413
|
+
return readFileSync(historyPath, "utf8")
|
|
414
|
+
.split("\n")
|
|
415
|
+
.map((line) => line.trim())
|
|
416
|
+
.filter((line) => line.length > 0)
|
|
417
|
+
.flatMap((line) => {
|
|
418
|
+
try {
|
|
419
|
+
return [JSON.parse(line)];
|
|
420
|
+
}
|
|
421
|
+
catch {
|
|
422
|
+
return [];
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
function writeMetricsHistoryEntries(rootDir, entries) {
|
|
427
|
+
const historyPath = getIosmMetricsHistoryPath(rootDir);
|
|
428
|
+
const contents = entries.map((entry) => JSON.stringify(entry)).join("\n");
|
|
429
|
+
writeFileSync(historyPath, contents.length > 0 ? `${contents}\n` : "", "utf8");
|
|
430
|
+
}
|
|
431
|
+
function toHistoryEntry(report) {
|
|
432
|
+
if (!hasCompleteNumericMetricRecord(report.metrics) ||
|
|
433
|
+
!hasCompleteNumericMetricRecord(report.metric_confidences) ||
|
|
434
|
+
!hasCompleteTierMetricRecord(report.metric_tiers) ||
|
|
435
|
+
!hasCompleteNumericMetricRecord(report.metric_deltas) ||
|
|
436
|
+
report.iosm_index === null ||
|
|
437
|
+
report.decision_confidence === null) {
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
440
|
+
return {
|
|
441
|
+
cycle_id: report.cycle_id,
|
|
442
|
+
recorded_at: new Date().toISOString(),
|
|
443
|
+
status: report.status,
|
|
444
|
+
metrics: report.metrics,
|
|
445
|
+
metric_confidences: report.metric_confidences,
|
|
446
|
+
metric_tiers: report.metric_tiers,
|
|
447
|
+
metric_deltas: report.metric_deltas,
|
|
448
|
+
decline_coverage: report.decline_coverage,
|
|
449
|
+
iosm_index: report.iosm_index,
|
|
450
|
+
decision_confidence: report.decision_confidence,
|
|
451
|
+
has_blocking_failure: hasBlockingFailure(report),
|
|
452
|
+
has_guardrail_violation: report.guardrails.pass === false,
|
|
453
|
+
has_active_blocking_waiver: hasActiveBlockingWaiver(report),
|
|
454
|
+
incomplete: report.incomplete,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
function deriveDecision(report, config, historyEntries) {
|
|
458
|
+
if (report.status === "failed" || hasBlockingFailure(report) || report.guardrails.pass === false) {
|
|
459
|
+
return "FAIL";
|
|
460
|
+
}
|
|
461
|
+
if (config.iosm.metadata.criticality_profile === "exploratory") {
|
|
462
|
+
return "CONTINUE";
|
|
463
|
+
}
|
|
464
|
+
if (report.incomplete ||
|
|
465
|
+
!hasCompleteNumericMetricRecord(report.metrics) ||
|
|
466
|
+
!hasCompleteNumericMetricRecord(report.metric_confidences) ||
|
|
467
|
+
!hasCompleteTierMetricRecord(report.metric_tiers) ||
|
|
468
|
+
report.iosm_index === null ||
|
|
469
|
+
report.decision_confidence === null) {
|
|
470
|
+
return "CONTINUE";
|
|
471
|
+
}
|
|
472
|
+
if (report.decision_confidence < config.iosm.evidence.min_decision_confidence) {
|
|
473
|
+
return "CONTINUE";
|
|
474
|
+
}
|
|
475
|
+
if (!metricFloorsMet(report.metrics, config.iosm.cycle_policy.stabilization)) {
|
|
476
|
+
return "CONTINUE";
|
|
477
|
+
}
|
|
478
|
+
if (!evidenceThresholdsMet(report.metric_confidences, config.iosm.evidence.min_metric_confidence)) {
|
|
479
|
+
return "CONTINUE";
|
|
480
|
+
}
|
|
481
|
+
if (hasActiveBlockingWaiver(report)) {
|
|
482
|
+
return "CONTINUE";
|
|
483
|
+
}
|
|
484
|
+
const currentEntry = toHistoryEntry(report);
|
|
485
|
+
if (!currentEntry) {
|
|
486
|
+
return "CONTINUE";
|
|
487
|
+
}
|
|
488
|
+
const relevantHistory = historyEntries.filter((entry) => entry.cycle_id !== report.cycle_id);
|
|
489
|
+
const combined = [...relevantHistory, currentEntry];
|
|
490
|
+
if (hasExcessUnexplainedDrift(combined, config.iosm.cycle_policy.stabilization.max_consecutive_unexplained_declines)) {
|
|
491
|
+
return "CONTINUE";
|
|
492
|
+
}
|
|
493
|
+
const recent = combined.slice(-config.iosm.cycle_policy.stabilization.consecutive_cycles);
|
|
494
|
+
if (recent.length < config.iosm.cycle_policy.stabilization.consecutive_cycles) {
|
|
495
|
+
return "CONTINUE";
|
|
496
|
+
}
|
|
497
|
+
if (recent.some((entry) => entry.has_blocking_failure ||
|
|
498
|
+
entry.has_guardrail_violation ||
|
|
499
|
+
entry.has_active_blocking_waiver ||
|
|
500
|
+
entry.incomplete ||
|
|
501
|
+
!metricFloorsMet(entry.metrics, config.iosm.cycle_policy.stabilization))) {
|
|
502
|
+
return "CONTINUE";
|
|
503
|
+
}
|
|
504
|
+
if (config.iosm.metadata.criticality_profile === "critical" &&
|
|
505
|
+
!hasTierAWindow(recent, ["logic", "performance"])) {
|
|
506
|
+
return "CONTINUE";
|
|
507
|
+
}
|
|
508
|
+
if (recent.every((entry) => entry.iosm_index >= config.iosm.cycle_policy.stabilization.target_index)) {
|
|
509
|
+
return "STOP";
|
|
510
|
+
}
|
|
511
|
+
return "CONTINUE";
|
|
512
|
+
}
|
|
513
|
+
function hydrateCycleReport(rootDir, cycleId, config) {
|
|
514
|
+
const reportPath = getIosmCycleReportPath(cycleId, rootDir);
|
|
515
|
+
if (!existsSync(reportPath)) {
|
|
516
|
+
throw new Error(`Missing cycle report for ${cycleId}: ${reportPath}`);
|
|
517
|
+
}
|
|
518
|
+
const rawReport = readJson(reportPath);
|
|
519
|
+
const reportObject = isPlainObject(rawReport) ? rawReport : {};
|
|
520
|
+
const goals = asStringArray(reportObject.goals);
|
|
521
|
+
const hypothesisCards = existsSync(getIosmHypothesesPath(cycleId, rootDir))
|
|
522
|
+
? readJson(getIosmHypothesesPath(cycleId, rootDir))
|
|
523
|
+
: [];
|
|
524
|
+
const hypotheses = normalizeHypotheses(reportObject.hypotheses, hypothesisCards);
|
|
525
|
+
const cycleScope = normalizeCycleScope(reportObject.cycle_scope);
|
|
526
|
+
const phaseReports = loadPhaseReports(rootDir, cycleId);
|
|
527
|
+
const gates = deriveGateResults(phaseReports, reportObject.gates);
|
|
528
|
+
const phasePointers = derivePhasePointers(rootDir, cycleId, phaseReports);
|
|
529
|
+
const metrics = mergeMetricValues(normalizeMetricNumbers(reportObject.metrics, null), calculateIosmMetricsFromRawMeasurements(isPlainObject(reportObject.raw_measurements) ? reportObject.raw_measurements : {}, config));
|
|
530
|
+
const metricConfidences = normalizeMetricNumbers(reportObject.metric_confidences, null);
|
|
531
|
+
const metricTiers = normalizeMetricTiers(reportObject.metric_tiers);
|
|
532
|
+
const baselineMetrics = loadBaselineMetrics(rootDir, cycleId, config);
|
|
533
|
+
const cycleCapacity = createCycleCapacity(goals, cycleScope, hypothesisCards, config.iosm.cycle_capacity);
|
|
534
|
+
const effectiveBudget = buildCycleBudget(config.iosm.guardrails.max_negative_delta, hypothesisCards);
|
|
535
|
+
const waivers = Array.isArray(reportObject.waivers) ? reportObject.waivers.filter(isPlainObject) : [];
|
|
536
|
+
const metricDeltas = mergeMetricValues(normalizeMetricNumbers(reportObject.metric_deltas, null), calculateMetricDeltas(baselineMetrics, metrics));
|
|
537
|
+
const declineCoverage = hasCompleteNumericMetricRecord(baselineMetrics) && hasCompleteNumericMetricRecord(metrics)
|
|
538
|
+
? assessDeclineCoverage(baselineMetrics, metrics, hypothesisCards, hasActiveBlockingWaivers(waivers))
|
|
539
|
+
: normalizeMetricBooleans(reportObject.decline_coverage, true);
|
|
540
|
+
const guardrailResult = validateGuardrails(baselineMetrics, metrics, effectiveBudget);
|
|
541
|
+
const historyEntries = readMetricsHistoryEntries(rootDir);
|
|
542
|
+
const report = {
|
|
543
|
+
cycle_id: cycleId,
|
|
544
|
+
status: asString(reportObject.status) === "active" ||
|
|
545
|
+
asString(reportObject.status) === "completed" ||
|
|
546
|
+
asString(reportObject.status) === "failed"
|
|
547
|
+
? asString(reportObject.status)
|
|
548
|
+
: "planned",
|
|
549
|
+
system: asString(reportObject.system) ?? config.iosm.metadata.system_name,
|
|
550
|
+
scope: asString(reportObject.scope) ?? config.iosm.metadata.scope,
|
|
551
|
+
criticality_profile: asString(reportObject.criticality_profile) ?? config.iosm.metadata.criticality_profile,
|
|
552
|
+
delivery_boundary: asString(reportObject.delivery_boundary) ?? config.iosm.metadata.delivery_boundary,
|
|
553
|
+
cycle_scope: cycleScope,
|
|
554
|
+
cycle_capacity: cycleCapacity,
|
|
555
|
+
window: asString(reportObject.window) ?? "",
|
|
556
|
+
goals,
|
|
557
|
+
hypotheses,
|
|
558
|
+
hypothesis_interactions: isPlainObject(reportObject.hypothesis_interactions)
|
|
559
|
+
? {
|
|
560
|
+
pass: asBoolean(reportObject.hypothesis_interactions.pass) ?? buildHypothesisInteractions(hypothesisCards).pass,
|
|
561
|
+
conflicts: Array.isArray(reportObject.hypothesis_interactions.conflicts)
|
|
562
|
+
? reportObject.hypothesis_interactions.conflicts.filter(isPlainObject)
|
|
563
|
+
: buildHypothesisInteractions(hypothesisCards).conflicts,
|
|
564
|
+
}
|
|
565
|
+
: buildHypothesisInteractions(hypothesisCards),
|
|
566
|
+
phase_reports: phasePointers,
|
|
567
|
+
gates,
|
|
568
|
+
metrics,
|
|
569
|
+
metric_confidences: metricConfidences,
|
|
570
|
+
metric_tiers: metricTiers,
|
|
571
|
+
raw_measurements: isPlainObject(reportObject.raw_measurements) ? reportObject.raw_measurements : {},
|
|
572
|
+
guardrails: {
|
|
573
|
+
pass: guardrailResult.pass ??
|
|
574
|
+
(isPlainObject(reportObject.guardrails) ? (asBoolean(reportObject.guardrails.pass) ?? null) : null),
|
|
575
|
+
effective_budget: effectiveBudget,
|
|
576
|
+
violations: guardrailResult.pass !== null
|
|
577
|
+
? guardrailResult.violations
|
|
578
|
+
: (() => {
|
|
579
|
+
const rawViolations = isPlainObject(reportObject.guardrails) ? reportObject.guardrails.violations : undefined;
|
|
580
|
+
if (!Array.isArray(rawViolations)) {
|
|
581
|
+
return [];
|
|
582
|
+
}
|
|
583
|
+
return rawViolations.filter(isPlainObject).flatMap((entry) => {
|
|
584
|
+
const metric = asString(entry.metric);
|
|
585
|
+
const negativeDelta = asNumber(entry.negative_delta);
|
|
586
|
+
const budget = asNumber(entry.budget);
|
|
587
|
+
if ((metric !== "semantic" &&
|
|
588
|
+
metric !== "logic" &&
|
|
589
|
+
metric !== "performance" &&
|
|
590
|
+
metric !== "simplicity" &&
|
|
591
|
+
metric !== "modularity" &&
|
|
592
|
+
metric !== "flow") ||
|
|
593
|
+
negativeDelta === undefined ||
|
|
594
|
+
budget === undefined) {
|
|
595
|
+
return [];
|
|
596
|
+
}
|
|
597
|
+
return [
|
|
598
|
+
{
|
|
599
|
+
metric,
|
|
600
|
+
negative_delta: negativeDelta,
|
|
601
|
+
budget,
|
|
602
|
+
},
|
|
603
|
+
];
|
|
604
|
+
});
|
|
605
|
+
})(),
|
|
606
|
+
},
|
|
607
|
+
metric_deltas: metricDeltas,
|
|
608
|
+
decline_coverage: declineCoverage,
|
|
609
|
+
iosm_index: calculateIosmIndex(metrics, config.iosm.index.weights) ??
|
|
610
|
+
(asNumber(reportObject.iosm_index) ?? null),
|
|
611
|
+
decision_confidence: calculateDecisionConfidence(metricConfidences, config.iosm.index.weights) ??
|
|
612
|
+
(asNumber(reportObject.decision_confidence) ?? null),
|
|
613
|
+
waivers,
|
|
614
|
+
automation_actors: Array.isArray(reportObject.automation_actors)
|
|
615
|
+
? reportObject.automation_actors.filter(isPlainObject).map((entry) => ({
|
|
616
|
+
type: asString(entry.type) ?? "unknown",
|
|
617
|
+
role: asString(entry.role) ?? "observer",
|
|
618
|
+
identity: asString(entry.identity),
|
|
619
|
+
provenance: asString(entry.provenance),
|
|
620
|
+
}))
|
|
621
|
+
: [{ type: "agent", role: "analyst", identity: "iosm-cli" }],
|
|
622
|
+
approval_path: Array.isArray(reportObject.approval_path)
|
|
623
|
+
? reportObject.approval_path.filter(isPlainObject).map((entry) => ({
|
|
624
|
+
action: asString(entry.action) ?? "unspecified",
|
|
625
|
+
required: asBoolean(entry.required) ?? false,
|
|
626
|
+
approved_by: asString(entry.approved_by),
|
|
627
|
+
approved_at: asString(entry.approved_at),
|
|
628
|
+
notes: asString(entry.notes),
|
|
629
|
+
}))
|
|
630
|
+
: [],
|
|
631
|
+
anti_patterns: Array.isArray(reportObject.anti_patterns)
|
|
632
|
+
? reportObject.anti_patterns.filter(isPlainObject)
|
|
633
|
+
: [],
|
|
634
|
+
learning_artifacts: asStringArray(reportObject.learning_artifacts),
|
|
635
|
+
incomplete: true,
|
|
636
|
+
decision: "CONTINUE",
|
|
637
|
+
};
|
|
638
|
+
report.incomplete =
|
|
639
|
+
!hasCompleteNumericMetricRecord(report.metrics) ||
|
|
640
|
+
!hasCompleteNumericMetricRecord(report.metric_confidences) ||
|
|
641
|
+
!hasCompleteTierMetricRecord(report.metric_tiers) ||
|
|
642
|
+
report.window.length === 0;
|
|
643
|
+
report.decision = deriveDecision(report, config, historyEntries);
|
|
644
|
+
return report;
|
|
645
|
+
}
|
|
646
|
+
function resolveCycleId(rootDir, cycleId) {
|
|
647
|
+
const cyclesDir = getIosmCyclesDir(rootDir);
|
|
648
|
+
if (!existsSync(cyclesDir)) {
|
|
649
|
+
throw new Error(`No cycles found in ${cyclesDir}.`);
|
|
650
|
+
}
|
|
651
|
+
const entries = readdirSync(cyclesDir)
|
|
652
|
+
.filter((entry) => entry !== ".gitkeep")
|
|
653
|
+
.sort();
|
|
654
|
+
if (entries.length === 0) {
|
|
655
|
+
throw new Error(`No cycles found in ${cyclesDir}.`);
|
|
656
|
+
}
|
|
657
|
+
if (!cycleId) {
|
|
658
|
+
return entries[entries.length - 1];
|
|
659
|
+
}
|
|
660
|
+
const exactMatch = entries.find((entry) => entry === cycleId);
|
|
661
|
+
if (exactMatch) {
|
|
662
|
+
return exactMatch;
|
|
663
|
+
}
|
|
664
|
+
const prefixMatches = entries.filter((entry) => entry.startsWith(cycleId));
|
|
665
|
+
if (prefixMatches.length === 1) {
|
|
666
|
+
return prefixMatches[0];
|
|
667
|
+
}
|
|
668
|
+
if (prefixMatches.length > 1) {
|
|
669
|
+
throw new Error(`Cycle id "${cycleId}" is ambiguous: ${prefixMatches.join(", ")}`);
|
|
670
|
+
}
|
|
671
|
+
throw new Error(`Cycle "${cycleId}" not found.`);
|
|
672
|
+
}
|
|
673
|
+
export function planIosmCycle(options) {
|
|
674
|
+
const { rootDir, config } = loadIosmConfig(options.cwd ?? process.cwd());
|
|
675
|
+
if (options.goals.length === 0) {
|
|
676
|
+
throw new Error("At least one goal is required. Example: iosm cycle plan \"reduce latency\"");
|
|
677
|
+
}
|
|
678
|
+
if (options.goals.length > config.iosm.cycle_capacity.max_goals) {
|
|
679
|
+
throw new Error(`Goal count ${options.goals.length} exceeds iosm.cycle_capacity.max_goals=${config.iosm.cycle_capacity.max_goals}. Reduce the plan before starting a cycle.`);
|
|
680
|
+
}
|
|
681
|
+
const cycleId = options.cycleId ?? nextCycleId(rootDir);
|
|
682
|
+
const cycleDir = getIosmCycleDir(cycleId, rootDir);
|
|
683
|
+
const force = options.force ?? false;
|
|
684
|
+
if (existsSync(cycleDir) && !force) {
|
|
685
|
+
throw new Error(`Cycle ${cycleId} already exists. Use --force to overwrite its scaffold.`);
|
|
686
|
+
}
|
|
687
|
+
mkdirSync(cycleDir, { recursive: true });
|
|
688
|
+
mkdirSync(getIosmPhaseReportsDir(cycleId, rootDir), { recursive: true });
|
|
689
|
+
const hypotheses = createHypotheses(options.goals, config);
|
|
690
|
+
const report = createCycleReport(rootDir, cycleId, options.goals, hypotheses, config);
|
|
691
|
+
if (!report.cycle_capacity.pass) {
|
|
692
|
+
throw new Error(`Cycle ${cycleId} exceeds configured capacity. Reduce goals or scope before planning.`);
|
|
693
|
+
}
|
|
694
|
+
const interactions = buildHypothesisInteractions(hypotheses);
|
|
695
|
+
if (!interactions.pass) {
|
|
696
|
+
throw new Error(`Hypothesis interactions are not safe: ${JSON.stringify(interactions.conflicts)}`);
|
|
697
|
+
}
|
|
698
|
+
const baselineReport = createBaselineReport(rootDir, cycleId, config, report.cycle_scope);
|
|
699
|
+
writeScaffoldFile(getIosmBaselineReportPath(cycleId, rootDir), baselineReport, force);
|
|
700
|
+
writeScaffoldFile(getIosmHypothesesPath(cycleId, rootDir), hypotheses, force);
|
|
701
|
+
writeScaffoldFile(getIosmCycleReportPath(cycleId, rootDir), report, force);
|
|
702
|
+
for (const phase of IOSM_PHASES) {
|
|
703
|
+
writeScaffoldFile(getIosmPhaseReportPath(cycleId, phase, rootDir), createPhaseReport(phase), force);
|
|
704
|
+
}
|
|
705
|
+
return {
|
|
706
|
+
cycleId,
|
|
707
|
+
cycleDir,
|
|
708
|
+
reportPath: getIosmCycleReportPath(cycleId, rootDir),
|
|
709
|
+
baselineReportPath: getIosmBaselineReportPath(cycleId, rootDir),
|
|
710
|
+
hypothesesPath: getIosmHypothesesPath(cycleId, rootDir),
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
export function listIosmCycles(cwd = process.cwd()) {
|
|
714
|
+
const rootDir = resolveIosmRootDir(cwd);
|
|
715
|
+
const { config } = loadIosmConfig(rootDir);
|
|
716
|
+
const cyclesDir = getIosmCyclesDir(rootDir);
|
|
717
|
+
if (!existsSync(cyclesDir)) {
|
|
718
|
+
return [];
|
|
719
|
+
}
|
|
720
|
+
return readdirSync(cyclesDir)
|
|
721
|
+
.filter((entry) => entry !== ".gitkeep")
|
|
722
|
+
.sort((left, right) => right.localeCompare(left))
|
|
723
|
+
.map((cycleId) => {
|
|
724
|
+
const reportPath = getIosmCycleReportPath(cycleId, rootDir);
|
|
725
|
+
if (!existsSync(reportPath)) {
|
|
726
|
+
return {
|
|
727
|
+
cycleId,
|
|
728
|
+
path: getIosmCycleDir(cycleId, rootDir),
|
|
729
|
+
status: "unknown",
|
|
730
|
+
goals: [],
|
|
731
|
+
decision: "unknown",
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
const report = hydrateCycleReport(rootDir, cycleId, config);
|
|
735
|
+
return {
|
|
736
|
+
cycleId,
|
|
737
|
+
path: getIosmCycleDir(cycleId, rootDir),
|
|
738
|
+
status: report.status,
|
|
739
|
+
goals: report.goals,
|
|
740
|
+
decision: report.decision,
|
|
741
|
+
};
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Async variant of listIosmCycles that hydrates all cycle reports in parallel.
|
|
746
|
+
* Significantly faster than the synchronous version when many cycles exist.
|
|
747
|
+
*/
|
|
748
|
+
export async function listIosmCyclesAsync(cwd = process.cwd()) {
|
|
749
|
+
const rootDir = resolveIosmRootDir(cwd);
|
|
750
|
+
const { config } = loadIosmConfig(rootDir);
|
|
751
|
+
const cyclesDir = getIosmCyclesDir(rootDir);
|
|
752
|
+
if (!existsSync(cyclesDir)) {
|
|
753
|
+
return [];
|
|
754
|
+
}
|
|
755
|
+
const cycleIds = readdirSync(cyclesDir)
|
|
756
|
+
.filter((entry) => entry !== ".gitkeep")
|
|
757
|
+
.sort((left, right) => right.localeCompare(left));
|
|
758
|
+
return Promise.all(cycleIds.map(async (cycleId) => {
|
|
759
|
+
const reportPath = getIosmCycleReportPath(cycleId, rootDir);
|
|
760
|
+
if (!existsSync(reportPath)) {
|
|
761
|
+
return {
|
|
762
|
+
cycleId,
|
|
763
|
+
path: getIosmCycleDir(cycleId, rootDir),
|
|
764
|
+
status: "unknown",
|
|
765
|
+
goals: [],
|
|
766
|
+
decision: "unknown",
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
// hydrateCycleReport is sync CPU-bound but I/O is already in the OS cache
|
|
770
|
+
// after the readdirSync above; Promise.all still de-serialises JS execution
|
|
771
|
+
const report = hydrateCycleReport(rootDir, cycleId, config);
|
|
772
|
+
return {
|
|
773
|
+
cycleId,
|
|
774
|
+
path: getIosmCycleDir(cycleId, rootDir),
|
|
775
|
+
status: report.status,
|
|
776
|
+
goals: report.goals,
|
|
777
|
+
decision: report.decision,
|
|
778
|
+
};
|
|
779
|
+
}));
|
|
780
|
+
}
|
|
781
|
+
export function readIosmCycleReport(cwd = process.cwd(), cycleId) {
|
|
782
|
+
const { rootDir, config } = loadIosmConfig(cwd);
|
|
783
|
+
const resolvedCycleId = resolveCycleId(rootDir, cycleId);
|
|
784
|
+
return hydrateCycleReport(rootDir, resolvedCycleId, config);
|
|
785
|
+
}
|
|
786
|
+
export function inspectIosmCycle(cwd = process.cwd(), cycleId) {
|
|
787
|
+
const { rootDir } = loadIosmConfig(cwd);
|
|
788
|
+
const resolvedCycleId = resolveCycleId(rootDir, cycleId);
|
|
789
|
+
const report = readIosmCycleReport(rootDir, resolvedCycleId);
|
|
790
|
+
const warnings = [];
|
|
791
|
+
const blockingIssues = [];
|
|
792
|
+
if (!existsSync(getIosmBaselineReportPath(resolvedCycleId, rootDir))) {
|
|
793
|
+
blockingIssues.push("Baseline Report is missing.");
|
|
794
|
+
}
|
|
795
|
+
if (!existsSync(getIosmHypothesesPath(resolvedCycleId, rootDir))) {
|
|
796
|
+
blockingIssues.push("Hypothesis Card Set is missing.");
|
|
797
|
+
}
|
|
798
|
+
for (const phase of IOSM_PHASES) {
|
|
799
|
+
if (!existsSync(getIosmPhaseReportPath(resolvedCycleId, phase, rootDir))) {
|
|
800
|
+
blockingIssues.push(`Phase report is missing for ${phase}.`);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
if (countScopeItems(report.cycle_scope) === 0) {
|
|
804
|
+
blockingIssues.push("Cycle Scope is empty.");
|
|
805
|
+
}
|
|
806
|
+
if (!report.cycle_capacity.pass) {
|
|
807
|
+
blockingIssues.push("Cycle exceeds configured capacity.");
|
|
808
|
+
}
|
|
809
|
+
if (!report.hypothesis_interactions.pass) {
|
|
810
|
+
blockingIssues.push("Hypothesis interactions are not resolved.");
|
|
811
|
+
}
|
|
812
|
+
if (report.guardrails.pass === false) {
|
|
813
|
+
blockingIssues.push("Guardrails are violated.");
|
|
814
|
+
}
|
|
815
|
+
if (hasBlockingFailure(report)) {
|
|
816
|
+
blockingIssues.push("One or more quality gates failed without waiver.");
|
|
817
|
+
}
|
|
818
|
+
const learningClosed = report.learning_artifacts.length > 0;
|
|
819
|
+
if (!learningClosed) {
|
|
820
|
+
warnings.push("Learning closure is still empty.");
|
|
821
|
+
}
|
|
822
|
+
const historyRecorded = readMetricsHistoryEntries(rootDir).some((entry) => entry.cycle_id === report.cycle_id);
|
|
823
|
+
if (report.status === "completed" && !historyRecorded) {
|
|
824
|
+
warnings.push("Metrics history does not contain this completed cycle.");
|
|
825
|
+
}
|
|
826
|
+
if (report.incomplete) {
|
|
827
|
+
warnings.push("Report is incomplete: metrics, confidences, tiers, or observation window are missing.");
|
|
828
|
+
}
|
|
829
|
+
return {
|
|
830
|
+
cycleId: resolvedCycleId,
|
|
831
|
+
rootDir,
|
|
832
|
+
reportPath: getIosmCycleReportPath(resolvedCycleId, rootDir),
|
|
833
|
+
status: report.status,
|
|
834
|
+
decision: report.decision,
|
|
835
|
+
reportComplete: !report.incomplete && blockingIssues.length === 0,
|
|
836
|
+
learningClosed,
|
|
837
|
+
historyRecorded,
|
|
838
|
+
capacityPass: report.cycle_capacity.pass,
|
|
839
|
+
guardrailsPass: report.guardrails.pass,
|
|
840
|
+
blockingIssues,
|
|
841
|
+
warnings,
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
export function recordIosmCycleHistory(cwd = process.cwd(), cycleId) {
|
|
845
|
+
const { rootDir } = loadIosmConfig(cwd);
|
|
846
|
+
const report = readIosmCycleReport(rootDir, cycleId);
|
|
847
|
+
const entry = toHistoryEntry(report);
|
|
848
|
+
if (!entry) {
|
|
849
|
+
throw new Error(`Cycle ${report.cycle_id} is incomplete. Metrics, confidences, tiers, IOSM-Index, and decision confidence must be present before recording history.`);
|
|
850
|
+
}
|
|
851
|
+
const existingEntries = readMetricsHistoryEntries(rootDir);
|
|
852
|
+
const replaced = existingEntries.some((existingEntry) => existingEntry.cycle_id === entry.cycle_id);
|
|
853
|
+
const nextEntries = [...existingEntries.filter((existingEntry) => existingEntry.cycle_id !== entry.cycle_id), entry].sort((left, right) => left.cycle_id.localeCompare(right.cycle_id));
|
|
854
|
+
writeMetricsHistoryEntries(rootDir, nextEntries);
|
|
855
|
+
return {
|
|
856
|
+
cycleId: entry.cycle_id,
|
|
857
|
+
historyPath: getIosmMetricsHistoryPath(rootDir),
|
|
858
|
+
replaced,
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
//# sourceMappingURL=cycle.js.map
|