@fbincon/claude-code-statusline 0.0.0-stage → 3.0.0-beta.1
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 +21 -0
- package/LICENSE-Unicode.txt +39 -0
- package/LICENSE-Wcwidth.txt +27 -0
- package/README.md +90 -2
- package/bin/claude-statusline.js +2 -0
- package/candidate.json +1238 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.d.ts +35 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js +228 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/backend-preferences.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/backend-preferences.js +72 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/backend-preferences.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js +140 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/host.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/host.js +101 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/host.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.js +96 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/preferences.d.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/preferences.js +80 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/preferences.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.d.ts +45 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js +99 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/storage.d.ts +30 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/storage.js +134 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/storage.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js +89 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/context.d.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/context.js +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/context.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/entry.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/entry.js +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/errors.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/errors.js +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/errors.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +67 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.js +40 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +63 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js +153 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor.d.ts +14 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor.js +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js +142 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/launcher.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/launcher.js +91 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/launcher.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mod-ownership.d.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mod-ownership.js +109 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mod-ownership.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.d.ts +60 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.js +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js +234 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/ownership.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/ownership.js +41 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/ownership.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/paths.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/paths.js +14 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/paths.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/plan.d.ts +13 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/plan.js +92 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/plan.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.d.ts +19 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.js +91 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/slash-hook.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/slash-hook.js +94 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/slash-hook.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/transaction.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/transaction.js +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/transaction.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/main.d.ts +22 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +197 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/files.d.ts +7 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/files.js +134 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/files.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.d.ts +58 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js +144 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/official.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/official.js +125 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/official.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/service.d.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/service.js +55 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.js +95 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.js +48 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.d.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js +13 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/context.d.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/context.js +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/context.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.d.ts +19 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js +162 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/hook.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/hook.js +19 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/hook.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/io.d.ts +37 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/io.js +75 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/io.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/json-data.d.ts +9 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/json-data.js +241 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/json-data.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/collect.d.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/collect.js +14 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/collect.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/durations.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/durations.js +69 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/durations.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/protocol.d.ts +16 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/protocol.js +90 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/protocol.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/store.d.ts +25 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/store.js +80 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/store.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/registry.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/registry.js +40 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/registry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/collect.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/collect.js +59 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/collect.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/service.d.ts +17 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/service.js +69 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/store.d.ts +17 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/store.js +70 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/store.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/submissions.d.ts +13 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/submissions.js +75 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/submissions.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.d.ts +33 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.js +227 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +144 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/package.json +17 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-config/SKILL.md +80 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-configure/SKILL.md +19 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +37 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/hooks.json +6 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +820 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +503 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/forms.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +198 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/messages.ts +101 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +218 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/appearance.ts +29 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +254 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/forms.ts +167 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/guidance.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-review.ts +55 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/instances.ts +30 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/navigation.ts +98 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/numeric.ts +42 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/search.ts +114 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +276 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-unicode.ts +92 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +6842 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/index.ts +40 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/messages.ts +33 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/presentation.ts +62 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/launch.ts +25 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/preferences.ts +61 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/preview-preferences.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/session.ts +124 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/unicode.ts +121 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +47 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +159 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +84 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/surface.ts +89 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/catalog.ts +23 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/preview.ts +45 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/section.ts +49 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/shortcuts.ts +83 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/layout.ts +49 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/styled-text.ts +56 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/text.ts +23 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/theme.ts +27 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +49 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/hooks/hooks.json +1 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/hooks/observe.ts +279 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/checklists.ts +45 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/costs.ts +23 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/generated-contracts.ts +18 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/identity.ts +14 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/launch.ts +25 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/queue.ts +68 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/streams.ts +28 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/timing.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +19 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/backend-preferences.d.ts +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/backend-preferences.js +72 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/backend-preferences.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.d.ts +86 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js +3462 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog.js +17 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js +19 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +232 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/draft.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/draft.js +48 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/draft.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js +104 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.d.ts +11 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js +99 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/generated-constants.d.ts +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/generated-constants.js +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/generated-constants.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js +80 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.d.ts +29 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js +159 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js +34 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.js +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/validation.d.ts +15 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/validation.js +55 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/validation.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.d.ts +33 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/runtime.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/runtime.js +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/runtime.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +663 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +401 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +73 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +251 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js +146 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/guidance.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/guidance.js +17 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/guidance.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.d.ts +19 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.js +53 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/instances.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/instances.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/instances.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/navigation.d.ts +37 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/navigation.js +73 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/navigation.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/numeric.d.ts +11 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/numeric.js +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/numeric.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/search.d.ts +22 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/search.js +122 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/search.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text.js +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +6841 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +6841 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/messages.d.ts +16 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/messages.js +38 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/messages.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/registry.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/registry.js +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/registry.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-Hant.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-Hant.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-Hant.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/integration/binding.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/integration/binding.js +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/integration/binding.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-equality.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-equality.js +31 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-equality.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-read.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-read.js +137 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-read.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-text.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-text.js +56 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-text.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json.js +165 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/numbers.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/numbers.js +47 -0
- package/node_modules/@fbincon/statusline-core/dist/src/numbers.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/ordered-record.d.ts +21 -0
- package/node_modules/@fbincon/statusline-core/dist/src/ordered-record.js +105 -0
- package/node_modules/@fbincon/statusline-core/dist/src/ordered-record.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/release.js +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/release.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js +73 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/coercion.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/coercion.js +50 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/coercion.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/colors.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/colors.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/colors.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js +49 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.d.ts +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.js +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/formatters.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/formatters.js +58 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/formatters.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/git.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/git.js +34 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/git.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.d.ts +49 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +399 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/language.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/language.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/language.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.d.ts +19 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js +176 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/live.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/live.js +29 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/live.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/metrics.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/metrics.js +93 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/metrics.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/numeric-format.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/numeric-format.js +46 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/numeric-format.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/palette.d.ts +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/palette.js +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/palette.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +76 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.d.ts +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js +98 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.d.ts +67 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.js +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/styles.d.ts +24 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/styles.js +116 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/styles.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +305 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/timer.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/timer.js +33 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/timer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/visibility.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/visibility.js +52 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/visibility.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.js +115 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/bindings.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/bindings.js +104 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/bindings.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.d.ts +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.js +196 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/ownership.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/ownership.js +45 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/ownership.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/reducer.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/reducer.js +228 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/reducer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.d.ts +24 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.js +145 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.js +70 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/state.d.ts +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/state.js +110 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/state.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/agents.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/agents.js +75 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/agents.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/hooks.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/hooks.js +121 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/hooks.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/model.d.ts +43 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/model.js +198 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/model.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/native.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/native.js +192 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/native.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/transitions.d.ts +16 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/transitions.js +245 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/transitions.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/view.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/view.js +28 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/view.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/transcript.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/transcript.js +183 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/transcript.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.d.ts +64 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.js +263 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/values.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/values.js +103 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/values.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/key.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/key.js +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/key.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/spans.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/spans.js +50 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/spans.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/sample.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/sample.js +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/sample.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/timer.d.ts +22 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/timer.js +75 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/timer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/generated-unicode.d.ts +12 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/generated-unicode.js +93 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/generated-unicode.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/index.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/index.js +178 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/index.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/package.json +8 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/languages.json +7 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +1367 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +1367 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +1367 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +1367 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-Hant.json +1367 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/architecture.d.ts +15 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/architecture.js +22 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/architecture.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/clocks.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/clocks.js +102 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/clocks.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/command.d.ts +16 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/command.js +18 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/command.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/commands.d.ts +12 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/commands.js +160 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/commands.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/errors.d.ts +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/errors.js +19 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/errors.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/files.d.ts +8 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js +164 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/hash.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/hash.js +5 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/hash.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/input.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/input.js +14 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/input.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/launch.d.ts +12 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/launch.js +21 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/launch.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/line-cursor.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/line-cursor.js +31 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/line-cursor.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/native.d.ts +15 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/native.js +36 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/native.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/plugin-host.d.ts +17 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/plugin-host.js +44 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/plugin-host.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/presentation.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/presentation.js +48 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/presentation.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/processes.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/processes.js +67 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/processes.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/bridge.d.ts +42 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/bridge.js +180 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/bridge.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.d.ts +11 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.js +81 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/launchers.d.ts +32 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/launchers.js +157 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/launchers.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.d.ts +18 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js +150 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.d.ts +6 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js +39 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/utf8.d.ts +5 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/utf8.js +82 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/utf8.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/package.json +8 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.d.ts +16 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +213 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/layout.d.ts +30 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/layout.js +34 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/layout.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +28 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +126 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +52 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +352 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/package.json +16 -0
- package/node_modules/@koromix/koffi-darwin-arm64/README.md +6 -0
- package/node_modules/@koromix/koffi-darwin-arm64/darwin_arm64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-darwin-arm64/index.js +1 -0
- package/node_modules/@koromix/koffi-darwin-arm64/package.json +24 -0
- package/node_modules/@koromix/koffi-darwin-x64/README.md +6 -0
- package/node_modules/@koromix/koffi-darwin-x64/darwin_x64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-darwin-x64/index.js +1 -0
- package/node_modules/@koromix/koffi-darwin-x64/package.json +24 -0
- package/node_modules/@koromix/koffi-linux-x64/README.md +6 -0
- package/node_modules/@koromix/koffi-linux-x64/index.js +198 -0
- package/node_modules/@koromix/koffi-linux-x64/linux_x64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-linux-x64/musl_x64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-linux-x64/package.json +24 -0
- package/node_modules/@koromix/koffi-win32-x64/README.md +6 -0
- package/node_modules/@koromix/koffi-win32-x64/index.js +1 -0
- package/node_modules/@koromix/koffi-win32-x64/package.json +24 -0
- package/node_modules/@koromix/koffi-win32-x64/win32_x64/koffi.lib +0 -0
- package/node_modules/@koromix/koffi-win32-x64/win32_x64/koffi.node +0 -0
- package/node_modules/koffi/LICENSE.txt +22 -0
- package/node_modules/koffi/README.md +46 -0
- package/node_modules/koffi/index.cjs +1 -0
- package/node_modules/koffi/index.d.ts +390 -0
- package/node_modules/koffi/index.js +2 -0
- package/node_modules/koffi/indirect.cjs +1 -0
- package/node_modules/koffi/indirect.js +2 -0
- package/node_modules/koffi/package.json +73 -0
- package/node_modules/koffi/src/koffi/index.cjs +327 -0
- package/node_modules/koffi/src/koffi/index.js +312 -0
- package/node_modules/koffi/src/koffi/indirect.cjs +326 -0
- package/node_modules/koffi/src/koffi/indirect.js +311 -0
- package/node_modules/koffi/src/koffi/src/static.cjs +170 -0
- package/node_modules/koffi/src/koffi/src/static.js +173 -0
- package/node_modules/lossless-json/LICENSE.md +9 -0
- package/node_modules/lossless-json/README.md +549 -0
- package/node_modules/lossless-json/lib/esm/LosslessNumber.js +92 -0
- package/node_modules/lossless-json/lib/esm/LosslessNumber.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/config.js +9 -0
- package/node_modules/lossless-json/lib/esm/config.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/index.js +9 -0
- package/node_modules/lossless-json/lib/esm/index.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/numberParsers.js +9 -0
- package/node_modules/lossless-json/lib/esm/numberParsers.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/package.json +3 -0
- package/node_modules/lossless-json/lib/esm/parse.js +346 -0
- package/node_modules/lossless-json/lib/esm/parse.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/revive.js +57 -0
- package/node_modules/lossless-json/lib/esm/revive.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/reviveDate.js +10 -0
- package/node_modules/lossless-json/lib/esm/reviveDate.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/stringify.js +166 -0
- package/node_modules/lossless-json/lib/esm/stringify.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/types.js +2 -0
- package/node_modules/lossless-json/lib/esm/types.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/utils.js +236 -0
- package/node_modules/lossless-json/lib/esm/utils.js.map +1 -0
- package/node_modules/lossless-json/lib/types/LosslessNumber.d.ts +40 -0
- package/node_modules/lossless-json/lib/types/LosslessNumber.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/config.d.ts +13 -0
- package/node_modules/lossless-json/lib/types/config.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/index.d.ts +9 -0
- package/node_modules/lossless-json/lib/types/index.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/numberParsers.d.ts +4 -0
- package/node_modules/lossless-json/lib/types/numberParsers.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/parse.d.ts +33 -0
- package/node_modules/lossless-json/lib/types/parse.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/revive.d.ts +13 -0
- package/node_modules/lossless-json/lib/types/revive.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/reviveDate.d.ts +5 -0
- package/node_modules/lossless-json/lib/types/reviveDate.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/stringify.d.ts +37 -0
- package/node_modules/lossless-json/lib/types/stringify.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/types.d.ts +61 -0
- package/node_modules/lossless-json/lib/types/types.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/utils.d.ts +79 -0
- package/node_modules/lossless-json/lib/types/utils.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/umd/lossless-json.js +1 -0
- package/node_modules/lossless-json/lib/umd/lossless-json.js.map +1 -0
- package/node_modules/lossless-json/lib/umd/package.json +3 -0
- package/node_modules/lossless-json/package.json +89 -0
- package/package.json +57 -4
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { equalSettings } from '../../json-equality.js';
|
|
2
|
+
import { object, numeric, int, truth, dictionary } from '../values.js';
|
|
3
|
+
import * as model from './model.js';
|
|
4
|
+
export function empty(sessionId) {
|
|
5
|
+
return { schema_version: 1, session_id: sessionId, epoch: null, loaded_at_ms: null, heartbeat_at_ms: null, host_version: null, invalidated: null,
|
|
6
|
+
current_prompt_id: null, epochs: dictionary(), prompts: dictionary(), agents: dictionary(), permission: null, active_prompt_id: null,
|
|
7
|
+
current_main_turn_id: null, turns: dictionary(), tools: dictionary(), checklists: dictionary(), prompt_aliases: dictionary(), prompt_links: dictionary(),
|
|
8
|
+
agent_snapshot: null, requests: dictionary(), costs: dictionary(), wait_events: dictionary() };
|
|
9
|
+
}
|
|
10
|
+
export function validateState(value, sessionId) {
|
|
11
|
+
try {
|
|
12
|
+
const defaults = empty(sessionId);
|
|
13
|
+
if (!object(value) || !['schema_version', 'session_id', 'epochs', 'prompts', 'agents'].every(key => Object.hasOwn(value, key)) || !Object.keys(value).every(key => Object.hasOwn(defaults, key)) || !equalSettings(value.schema_version, 1) || value.session_id !== sessionId || !['epochs', 'prompts', 'agents'].every(key => object(value[key])))
|
|
14
|
+
return null;
|
|
15
|
+
const state = { ...defaults, ...value };
|
|
16
|
+
if (!['turns', 'tools', 'checklists', 'prompt_aliases', 'prompt_links', 'requests', 'costs'].every(key => object(state[key])))
|
|
17
|
+
return null;
|
|
18
|
+
for (const [epoch, ledger] of Object.entries(state.epochs)) {
|
|
19
|
+
model.text(epoch, 'epoch');
|
|
20
|
+
model.exact(ledger, ['seen', 'floor', 'high', 'updated_at_ms'], 'epoch ledger');
|
|
21
|
+
if (!Array.isArray(ledger.seen) || ledger.seen.length > model.MAX_SEEN || ledger.seen.some(seq => int(seq) === null || int(seq) < 0n) || ['floor', 'high'].some(key => int(ledger[key]) === null || int(ledger[key]) < -1n))
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (state.epoch !== null && (typeof state.epoch !== 'string' || !Object.hasOwn(state.epochs, state.epoch)))
|
|
25
|
+
return null;
|
|
26
|
+
for (const row of Object.values(state.prompts)) {
|
|
27
|
+
if (!object(row) || !['updated_at_ms', 'started_at_ms', 'epoch', 'complete', 'terminal'].every(key => Object.hasOwn(row, key)))
|
|
28
|
+
return null;
|
|
29
|
+
model.number(row.updated_at_ms, 'prompt time');
|
|
30
|
+
}
|
|
31
|
+
for (const row of Object.values(state.agents)) {
|
|
32
|
+
if (!object(row) || !['prompt_id', 'epoch', 'started_at_ms', 'ended_at_ms', 'status', 'updated_at_ms'].every(key => Object.hasOwn(row, key)))
|
|
33
|
+
return null;
|
|
34
|
+
model.number(row.updated_at_ms, 'agent time');
|
|
35
|
+
}
|
|
36
|
+
if (state.permission !== null)
|
|
37
|
+
model.exact(state.permission, ['mode', 'live', 'observed_at_ms', 'source'], 'permission');
|
|
38
|
+
validateViews(state);
|
|
39
|
+
return state;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function validateViews(state) {
|
|
46
|
+
if (Object.keys(state.prompt_links).length > model.MAX_AGENTS)
|
|
47
|
+
throw new Error('prompt links exceed their bound');
|
|
48
|
+
for (const [alias, target] of Object.entries(state.prompt_links)) {
|
|
49
|
+
model.text(alias, 'prompt link');
|
|
50
|
+
model.text(target, 'message link');
|
|
51
|
+
}
|
|
52
|
+
if (!object(state.wait_events) || Object.keys(state.wait_events).length > model.MAX_SEEN)
|
|
53
|
+
throw new Error('invalid waiting evidence');
|
|
54
|
+
for (const row of Object.values(state.wait_events)) {
|
|
55
|
+
model.validate(row);
|
|
56
|
+
if (!['wait_start', 'wait_end', 'wait_unknown'].includes(row.kind))
|
|
57
|
+
throw new Error('invalid waiting event kind');
|
|
58
|
+
}
|
|
59
|
+
for (const [table, maximum] of [['turns', model.MAX_TURNS], ['tools', model.MAX_TOOLS], ['requests', model.MAX_REQUESTS], ['costs', model.MAX_REQUESTS]]) {
|
|
60
|
+
if (Object.keys(state[table]).length > maximum)
|
|
61
|
+
throw new Error('runtime table exceeds its bound');
|
|
62
|
+
for (const row of Object.values(state[table])) {
|
|
63
|
+
if (!object(row))
|
|
64
|
+
throw new Error('invalid runtime view');
|
|
65
|
+
model.text(row.prompt_id, 'owner', true);
|
|
66
|
+
model.number(row.updated_at_ms, 'view time');
|
|
67
|
+
if (['turns', 'tools', 'requests'].includes(table)) {
|
|
68
|
+
model.text(row.agent_id, 'agent', true);
|
|
69
|
+
for (const name of table === 'tools' ? ['started_at_ms'] : ['started_at_ms', 'ended_at_ms'])
|
|
70
|
+
if (row[name] !== null)
|
|
71
|
+
model.number(row[name], name);
|
|
72
|
+
}
|
|
73
|
+
if (table === 'turns' && !['running', 'completed', 'failed', 'interrupted'].includes(row.status))
|
|
74
|
+
throw new Error('invalid turn status');
|
|
75
|
+
if (table === 'tools') {
|
|
76
|
+
model.text(row.name, 'tool name');
|
|
77
|
+
if (!['started', 'success', 'error', 'denied', 'interrupted'].includes(row.status))
|
|
78
|
+
throw new Error('invalid tool status');
|
|
79
|
+
}
|
|
80
|
+
if (table === 'requests' || table === 'costs') {
|
|
81
|
+
model.usage(row.usage);
|
|
82
|
+
if (typeof row.conflict !== 'boolean')
|
|
83
|
+
throw new Error('invalid conflict flag');
|
|
84
|
+
if (table === 'requests') {
|
|
85
|
+
model.text(row.turn_key, 'turn key', false, 1024);
|
|
86
|
+
model.text(row.epoch, 'request epoch');
|
|
87
|
+
if (typeof row.native !== 'boolean' || ![null, 'completed', 'failed', 'interrupted'].includes(row.status))
|
|
88
|
+
throw new Error('invalid request status');
|
|
89
|
+
if (row.first_at_ms !== null)
|
|
90
|
+
model.number(row.first_at_ms, 'first content time');
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
model.number(row.cost_usd, 'cost');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
for (const row of Object.values(state.checklists)) {
|
|
98
|
+
if (!object(row) || !object(row.tasks) || typeof row.complete !== 'boolean' || Object.keys(row.tasks).length > model.MAX_TASKS)
|
|
99
|
+
throw new Error('invalid checklist');
|
|
100
|
+
model.text(row.prompt_id, 'checklist owner', true);
|
|
101
|
+
model.number(row.updated_at_ms, 'checklist time');
|
|
102
|
+
if (Object.values(row.tasks).some(value => !['pending', 'in_progress', 'completed'].includes(value)))
|
|
103
|
+
throw new Error('invalid checklist entry');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function fresh(state, nowMs) {
|
|
107
|
+
const stamp = state ? numeric(state.heartbeat_at_ms) : null;
|
|
108
|
+
return state !== null && !truth(state.invalidated) && stamp !== null && nowMs - stamp >= 0 && nowMs - stamp <= model.STALE_MS;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../src/runtime/live/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AA+BpC,MAAM,UAAU,KAAK,CAAC,SAAiB;IACnC,OAAO,EAAE,cAAc,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,IAA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AAC,UAAU,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS;YAC1H,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QACnD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC;YAC1G,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,CAAC;AACL,CAAC;AACD,MAAM,UAAU,KAAK,CAAC,KAAuB,EAAE,KAAa;IACxD,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5D,OAAO,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC;AAClI,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Data } from '../values.js';
|
|
2
|
+
import { type TaskStore } from './model.js';
|
|
3
|
+
export declare function agentId(data: Data): string | null;
|
|
4
|
+
export declare function agentType(data: Data): string;
|
|
5
|
+
export declare function authoritativeSubagents(tasks: unknown, existing: unknown, wall: bigint): Record<string, Data> | null;
|
|
6
|
+
export declare function agentPrompt(store: TaskStore, prompt: string | null, agent: string | null, starting?: boolean): string | null;
|
|
7
|
+
export declare function startSubagent(store: TaskStore, prompt: string | null, data: Data, wall: bigint): string | null;
|
|
8
|
+
export declare function stopSubagent(store: TaskStore, prompt: string | null, data: Data, wall: bigint): string | null;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { int, truth, object, dictionary, own, maxInt } from '../values.js';
|
|
2
|
+
import { cleanActiveAgents, findTurn, rememberId, recordKey } from './model.js';
|
|
3
|
+
import { reopenLowPriority } from './transitions.js';
|
|
4
|
+
export function agentId(data) { return typeof data.agent_id === 'string' && data.agent_id ? data.agent_id : null; }
|
|
5
|
+
export function agentType(data) {
|
|
6
|
+
for (const key of ['agent_type', 'name', 'type'])
|
|
7
|
+
if (typeof data[key] === 'string' && data[key])
|
|
8
|
+
return data[key];
|
|
9
|
+
return 'Agent';
|
|
10
|
+
}
|
|
11
|
+
export function authoritativeSubagents(tasks, existing, wall) {
|
|
12
|
+
if (!Array.isArray(tasks))
|
|
13
|
+
return null;
|
|
14
|
+
const current = cleanActiveAgents(existing), snapshot = dictionary();
|
|
15
|
+
for (const task of tasks) {
|
|
16
|
+
if (!object(task) || task.type !== 'subagent' || typeof task.id !== 'string' || !task.id || Object.hasOwn(snapshot, task.id))
|
|
17
|
+
continue;
|
|
18
|
+
snapshot[task.id] = own(current, task.id) ?? { agent_type: agentType(task), started_wall_ns: wall };
|
|
19
|
+
}
|
|
20
|
+
return snapshot;
|
|
21
|
+
}
|
|
22
|
+
export function agentPrompt(store, prompt, agent, starting = false) {
|
|
23
|
+
if (starting && prompt)
|
|
24
|
+
return prompt;
|
|
25
|
+
let owners = store.turns.filter(record => agent !== null && Object.hasOwn(record.active_agents, agent));
|
|
26
|
+
if (owners.length === 1)
|
|
27
|
+
return owners[0].prompt_id;
|
|
28
|
+
owners = store.turns.filter(record => agent !== null && record.agent_ids.includes(agent));
|
|
29
|
+
if (owners.length === 1)
|
|
30
|
+
return owners[0].prompt_id;
|
|
31
|
+
return prompt ?? (store.turns.length === 1 ? store.current_prompt_id : null);
|
|
32
|
+
}
|
|
33
|
+
export function startSubagent(store, prompt, data, wall) {
|
|
34
|
+
const agent = agentId(data), target = agentPrompt(store, prompt, agent, true), record = findTurn(store, target);
|
|
35
|
+
if (!target || !record || !agent || wall < (int(record.started_wall_ns, false) ?? 0n) || !reopenLowPriority(record, wall))
|
|
36
|
+
return store.current_prompt_id;
|
|
37
|
+
const active = cleanActiveAgents(record.active_agents), previous = own(active, agent);
|
|
38
|
+
if (!previous)
|
|
39
|
+
Object.defineProperty(active, agent, { value: { agent_type: agentType(data), started_wall_ns: wall }, enumerable: true, configurable: true, writable: true });
|
|
40
|
+
else {
|
|
41
|
+
const started = int(previous.started_wall_ns, false);
|
|
42
|
+
if (started === null || started <= 0n || wall < started)
|
|
43
|
+
previous.started_wall_ns = wall;
|
|
44
|
+
}
|
|
45
|
+
record.active_agents = active;
|
|
46
|
+
if (object(record.stop_candidate) && wall > (int(record.stop_candidate.wall_ns) ?? wall)) {
|
|
47
|
+
record.stop_candidate = null;
|
|
48
|
+
record.phase = 'main';
|
|
49
|
+
}
|
|
50
|
+
record.had_subagents = true;
|
|
51
|
+
if (rememberId(record, 'agent_ids', agent))
|
|
52
|
+
rememberId(record, 'pending_agent_reports', agent);
|
|
53
|
+
if (record.phase === 'resuming_main')
|
|
54
|
+
record.phase = 'main';
|
|
55
|
+
record.updated_wall_ns = maxInt([recordKey(record), wall]);
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
58
|
+
export function stopSubagent(store, prompt, data, wall) {
|
|
59
|
+
const agent = agentId(data), target = agentPrompt(store, prompt, agent), record = findTurn(store, target);
|
|
60
|
+
if (!target || !record || record.status !== 'running' || !agent || wall < (int(record.started_wall_ns, false) ?? 0n))
|
|
61
|
+
return store.current_prompt_id;
|
|
62
|
+
record.had_subagents = true;
|
|
63
|
+
if (rememberId(record, 'agent_ids', agent))
|
|
64
|
+
rememberId(record, 'pending_agent_reports', agent);
|
|
65
|
+
const active = cleanActiveAgents(record.active_agents);
|
|
66
|
+
if (Object.hasOwn(active, agent)) {
|
|
67
|
+
delete active[agent];
|
|
68
|
+
record.active_agents = active;
|
|
69
|
+
record.updated_wall_ns = maxInt([recordKey(record), wall]);
|
|
70
|
+
if (record.phase === 'waiting_subagents' && !truth(active))
|
|
71
|
+
record.phase = 'resuming_main';
|
|
72
|
+
}
|
|
73
|
+
return target;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../../src/runtime/tasks/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAa,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,MAAM,UAAU,OAAO,CAAC,IAAU,IAAmB,OAAO,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxI,MAAM,UAAU,SAAS,CAAC,IAAU;IAChC,KAAK,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC;QAC5C,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC;YAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,OAAO,O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AM,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;QAChH,OAAO,KAAK,CAAC,iBAAiB,CAAC;IACnC,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,IAAI,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC;QACtC,UAAU,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACvD,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC;QAC9B,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,KAAK,KAAK,mBAAmB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YACtD,MAAM,CAAC,KAAK,GAAG,eAAe,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Sample } from '../../timing/sample.js';
|
|
2
|
+
import { type Data } from '../values.js';
|
|
3
|
+
import { type Turn, type TaskStore } from './model.js';
|
|
4
|
+
export interface Evidence {
|
|
5
|
+
submissionNs?: bigint | null;
|
|
6
|
+
modifiedNs?: bigint | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function needsSubmission(record: Turn | null, source: string): boolean;
|
|
9
|
+
export declare function refreshStartEvidence(record: Turn, data: Data, source: string, evidence: Evidence): void;
|
|
10
|
+
export declare function applyHook(store: TaskStore, data: Data, clocks: Sample, evidence?: Evidence): string | null;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { int, truth, string, object } from '../values.js';
|
|
2
|
+
import { findTurn, upsertTurn, terminalRecord, agentNotificationId, cleanActiveAgents, rememberId, elapsedNs, TERMINAL_STATUSES } from './model.js';
|
|
3
|
+
import { applyAgentNotification, applyLocalCommand, finishRecord, reopenLowPriority, priority } from './transitions.js';
|
|
4
|
+
import { authoritativeSubagents, startSubagent, stopSubagent } from './agents.js';
|
|
5
|
+
export function needsSubmission(record, source) {
|
|
6
|
+
return record === null || !record.submission_verified && !record.historical_frozen && !(TERMINAL_STATUSES.has(record.status) && priority(record.end_source) >= priority(source));
|
|
7
|
+
}
|
|
8
|
+
export function refreshStartEvidence(record, data, source, evidence) {
|
|
9
|
+
if (!needsSubmission(record, source) || typeof data.transcript_path !== 'string' || evidence.submissionNs == null)
|
|
10
|
+
return;
|
|
11
|
+
const started = evidence.submissionNs;
|
|
12
|
+
record.submission_verified = true;
|
|
13
|
+
const previous = int(record.started_wall_ns, false);
|
|
14
|
+
if (previous !== null && started >= previous)
|
|
15
|
+
return;
|
|
16
|
+
const boot = int(record.started_boot_ns, false), offset = previous === null ? null : previous - started;
|
|
17
|
+
record.started_boot_ns = boot !== null && offset !== null && offset >= 0n && offset <= boot ? boot - offset : null;
|
|
18
|
+
if (record.started_boot_ns === null)
|
|
19
|
+
record.boot_id = null;
|
|
20
|
+
record.started_wall_ns = started;
|
|
21
|
+
record.start_source = 'transcript';
|
|
22
|
+
}
|
|
23
|
+
export function applyHook(store, data, clocks, evidence = {}) {
|
|
24
|
+
const { wall_ns: wall, boot_ns: boot, boot_id: domain } = clocks;
|
|
25
|
+
const event = data.hook_event_name, prompt = truth(data.prompt_id) ? string(data.prompt_id) : null;
|
|
26
|
+
if (event === 'SubagentStart')
|
|
27
|
+
return startSubagent(store, prompt, data, wall);
|
|
28
|
+
if (event === 'SubagentStop')
|
|
29
|
+
return stopSubagent(store, prompt, data, wall);
|
|
30
|
+
if (truth(data.agent_id))
|
|
31
|
+
return store.current_prompt_id;
|
|
32
|
+
if (event === 'UserPromptSubmit') {
|
|
33
|
+
if (!prompt)
|
|
34
|
+
return store.current_prompt_id;
|
|
35
|
+
const notification = agentNotificationId(data.prompt);
|
|
36
|
+
if (notification) {
|
|
37
|
+
if (!applyAgentNotification(store, prompt, notification, wall))
|
|
38
|
+
applyLocalCommand(store, prompt, wall);
|
|
39
|
+
return store.current_prompt_id;
|
|
40
|
+
}
|
|
41
|
+
const record = findTurn(store, prompt);
|
|
42
|
+
if (!record)
|
|
43
|
+
upsertTurn(store, prompt, clocks, 'hook_submit');
|
|
44
|
+
const previous = findTurn(store, store.current_prompt_id);
|
|
45
|
+
if (previous && record && previous !== record && (int(record.started_wall_ns, false) ?? 0n) < (int(previous.started_wall_ns, false) ?? 0n))
|
|
46
|
+
return store.current_prompt_id;
|
|
47
|
+
if (previous && previous.prompt_id !== prompt && previous.status === 'running')
|
|
48
|
+
finishRecord(previous, 'unknown', wall, boot, domain, 'next_prompt', 'superseded_without_terminal_event');
|
|
49
|
+
store.current_prompt_id = prompt;
|
|
50
|
+
return prompt;
|
|
51
|
+
}
|
|
52
|
+
if (event === 'Stop') {
|
|
53
|
+
const target = prompt ?? store.current_prompt_id;
|
|
54
|
+
if (!target)
|
|
55
|
+
return store.current_prompt_id;
|
|
56
|
+
const current = findTurn(store, store.current_prompt_id), record = terminalRecord(store, target, clocks);
|
|
57
|
+
if (['failed', 'interrupted', 'ignored'].includes(record.status))
|
|
58
|
+
return store.current_prompt_id;
|
|
59
|
+
refreshStartEvidence(record, data, 'hook_stop', evidence);
|
|
60
|
+
const snapshot = authoritativeSubagents(data.background_tasks, record.active_agents, wall);
|
|
61
|
+
if (snapshot !== null && (record.status === 'running' || truth(snapshot) && reopenLowPriority(record, wall))) {
|
|
62
|
+
record.active_agents = snapshot;
|
|
63
|
+
if (truth(snapshot)) {
|
|
64
|
+
record.had_subagents = true;
|
|
65
|
+
for (const agent of Object.keys(snapshot))
|
|
66
|
+
if (rememberId(record, 'agent_ids', agent))
|
|
67
|
+
rememberId(record, 'pending_agent_reports', agent);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const active = cleanActiveAgents(record.active_agents), pending = record.report_aliases.length > 0 && record.pending_agent_reports.length > 0;
|
|
71
|
+
if ((truth(active) || pending) && reopenLowPriority(record, wall)) {
|
|
72
|
+
Object.assign(record, { status: 'running', phase: truth(active) ? 'waiting_subagents' : 'resuming_main', active_agents: active, ended_wall_ns: null, ended_boot_ns: null,
|
|
73
|
+
duration_ns: null, duration_source: null, end_source: null, end_reason: null, error: null, updated_wall_ns: wall });
|
|
74
|
+
}
|
|
75
|
+
else if (record.status === 'running' && !truth(record.stop_candidate)) {
|
|
76
|
+
record.stop_candidate = { wall_ns: wall, boot_ns: boot, boot_id: domain, duration_ns: elapsedNs(record, wall, boot, domain) };
|
|
77
|
+
record.phase = 'stop_pending';
|
|
78
|
+
record.updated_wall_ns = wall;
|
|
79
|
+
}
|
|
80
|
+
if (store.current_prompt_id === null || store.current_prompt_id === target || current && ['ignored', 'withdrawn'].includes(current.status))
|
|
81
|
+
store.current_prompt_id = record.prompt_id;
|
|
82
|
+
return store.current_prompt_id;
|
|
83
|
+
}
|
|
84
|
+
if (event === 'StopFailure') {
|
|
85
|
+
const error = truth(data.error) ? string(data.error) : 'unknown', target = prompt ?? store.current_prompt_id;
|
|
86
|
+
if (!target)
|
|
87
|
+
return store.current_prompt_id;
|
|
88
|
+
const current = findTurn(store, store.current_prompt_id), record = terminalRecord(store, target, clocks);
|
|
89
|
+
refreshStartEvidence(record, data, 'hook_stop_failure', evidence);
|
|
90
|
+
finishRecord(record, 'failed', wall, boot, domain, 'hook_stop_failure', 'stop_failure', error);
|
|
91
|
+
if (store.current_prompt_id === null || store.current_prompt_id === target || current && ['ignored', 'withdrawn'].includes(current.status))
|
|
92
|
+
store.current_prompt_id = record.prompt_id;
|
|
93
|
+
return store.current_prompt_id;
|
|
94
|
+
}
|
|
95
|
+
if (event === 'SessionEnd') {
|
|
96
|
+
const target = prompt ?? store.current_prompt_id, record = findTurn(store, target);
|
|
97
|
+
if (record?.status === 'running') {
|
|
98
|
+
refreshStartEvidence(record, data, 'hook_session_end', evidence);
|
|
99
|
+
const candidate = record.stop_candidate;
|
|
100
|
+
if (object(candidate) && (!Object.hasOwn(data, 'reason') || data.reason === 'other')) {
|
|
101
|
+
const at = int(candidate.wall_ns);
|
|
102
|
+
if (at !== null)
|
|
103
|
+
finishRecord(record, 'unknown', at, int(candidate.boot_ns), typeof candidate.boot_id === 'string' ? candidate.boot_id : null, 'session_exit_pending', 'unconfirmed_stop_before_exit', null, wall);
|
|
104
|
+
return store.current_prompt_id;
|
|
105
|
+
}
|
|
106
|
+
finishRecord(record, 'interrupted', wall, boot, domain, 'hook_session_end', 'session_end:' + (truth(data.reason) ? string(data.reason) : 'other'));
|
|
107
|
+
}
|
|
108
|
+
return store.current_prompt_id;
|
|
109
|
+
}
|
|
110
|
+
if (event === 'SessionStart') {
|
|
111
|
+
const source = truth(data.source) ? string(data.source) : 'startup', record = findTurn(store, store.current_prompt_id);
|
|
112
|
+
if (['startup', 'resume'].includes(source) && record?.status === 'running') {
|
|
113
|
+
let lower = truth(record.started_wall_ns) ? int(record.started_wall_ns, false) ?? wall : wall;
|
|
114
|
+
if (typeof data.transcript_path === 'string' && evidence.modifiedNs != null && evidence.modifiedNs > lower)
|
|
115
|
+
lower = evidence.modifiedNs;
|
|
116
|
+
finishRecord(record, 'unknown', lower > wall ? wall : lower, null, null, 'session_start', 'unconfirmed_previous_run', null, wall);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return store.current_prompt_id;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../src/runtime/tasks/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE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AAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YAC9F,IAAI,OAAO,IAAI,CAAC,eAAe,KAAK,QAAQ,IAAI,QAAQ,CAAC,UAAU,IAAI,IAAI,IAAI,QAAQ,CAAC,UAAU,GAAG,KAAK;gBACtG,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC;YAChC,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,0BAA0B,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACtI,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC,iBAAiB,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Sample } from '../../timing/sample.js';
|
|
2
|
+
import { type Data } from '../values.js';
|
|
3
|
+
export declare const SCHEMA = 1, LIFECYCLE_SCHEMA = 4, MAX_TURNS_PER_SESSION = 32, MAX_AGENT_HISTORY = 256;
|
|
4
|
+
export declare const TURN_FIELDS: readonly ["prompt_id", "status", "started_wall_ns", "started_boot_ns", "ended_wall_ns", "ended_boot_ns", "duration_ns", "boot_id", "start_source", "end_source", "end_reason", "error", "last_assistant_wall_ns", "updated_wall_ns", "phase", "had_subagents", "active_agents", "duration_source", "agent_ids", "prompt_aliases", "report_aliases", "pending_agent_reports", "stop_candidate", "native_duration_ms", "native_turns", "active_clock", "active_coverage", "submission_verified", "native_wait_seen", "historical_frozen"];
|
|
5
|
+
export declare const TERMINAL_STATUSES: Set<string>;
|
|
6
|
+
export declare const END_PRIORITY: Readonly<Record<string, number>>;
|
|
7
|
+
export interface Turn extends Data {
|
|
8
|
+
prompt_id: string;
|
|
9
|
+
status: string;
|
|
10
|
+
phase: string;
|
|
11
|
+
had_subagents: boolean;
|
|
12
|
+
active_agents: Record<string, Data>;
|
|
13
|
+
agent_ids: string[];
|
|
14
|
+
prompt_aliases: string[];
|
|
15
|
+
report_aliases: string[];
|
|
16
|
+
pending_agent_reports: string[];
|
|
17
|
+
native_turns: Record<string, Data>;
|
|
18
|
+
native_wait_seen: string[];
|
|
19
|
+
submission_verified: boolean;
|
|
20
|
+
historical_frozen: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface TaskStore extends Data {
|
|
23
|
+
schema: 4;
|
|
24
|
+
session_id: string;
|
|
25
|
+
current_prompt_id: string | null;
|
|
26
|
+
turns: Turn[];
|
|
27
|
+
updated_wall_ns: bigint;
|
|
28
|
+
}
|
|
29
|
+
export declare function recordKey(record: Data): bigint;
|
|
30
|
+
export declare function cleanIds(value: unknown): string[];
|
|
31
|
+
export declare function rememberId(record: Data, field: string, value: string): boolean;
|
|
32
|
+
export declare function agentNotificationId(content: unknown): string | null;
|
|
33
|
+
export declare function cleanActiveAgents(value: unknown): Record<string, Data>;
|
|
34
|
+
export declare function elapsedNs(record: Data, wall: unknown, boot: unknown, domain: unknown): bigint | null;
|
|
35
|
+
export declare function cleanRecord(record: unknown): Turn | null;
|
|
36
|
+
export declare function legacyRecord(state: unknown, historical?: boolean): Turn | null;
|
|
37
|
+
export declare function pruneTurns(store: TaskStore): void;
|
|
38
|
+
export declare function storeFromState(raw: unknown, sessionId: unknown): TaskStore;
|
|
39
|
+
export declare function findTurn(store: TaskStore, promptId?: unknown): Turn | null;
|
|
40
|
+
export declare function newRecord(promptId: unknown, clocks: Sample, source?: string): Turn;
|
|
41
|
+
export declare function upsertTurn(store: TaskStore, promptId: unknown, clocks: Sample, source?: string): Turn | null;
|
|
42
|
+
export declare function terminalRecord(store: TaskStore, promptId: unknown, clocks: Sample): Turn;
|
|
43
|
+
export declare function mirrorState(sessionId: unknown, store: TaskStore, preferredPromptId?: unknown): Data | null;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { delta } from '../../timing/sample.js';
|
|
2
|
+
import { int, truth, string, object, maxInt, compareInt, numeric } from '../values.js';
|
|
3
|
+
import { orderedRecord } from '../../ordered-record.js';
|
|
4
|
+
export const SCHEMA = 1, LIFECYCLE_SCHEMA = 4, MAX_TURNS_PER_SESSION = 32, MAX_AGENT_HISTORY = 256;
|
|
5
|
+
export const TURN_FIELDS = ['prompt_id', 'status', 'started_wall_ns', 'started_boot_ns', 'ended_wall_ns', 'ended_boot_ns', 'duration_ns', 'boot_id', 'start_source', 'end_source', 'end_reason', 'error', 'last_assistant_wall_ns', 'updated_wall_ns', 'phase', 'had_subagents', 'active_agents', 'duration_source', 'agent_ids', 'prompt_aliases', 'report_aliases', 'pending_agent_reports', 'stop_candidate', 'native_duration_ms', 'native_turns', 'active_clock', 'active_coverage', 'submission_verified', 'native_wait_seen', 'historical_frozen'];
|
|
6
|
+
export const TERMINAL_STATUSES = new Set(['completed', 'failed', 'interrupted', 'withdrawn', 'ignored', 'unknown']);
|
|
7
|
+
export const END_PRIORITY = { next_prompt: 10, session_start: 20, registry_withdrawn: 30, registry_idle: 40, transcript_interrupt: 95, local_command: 50, transcript_duration: 60, transcript_stop: 85, session_exit_pending: 50, hook_session_end: 95, hook_stop: 55, native_turn_end: 90, hook_stop_failure: 100 };
|
|
8
|
+
export function recordKey(record) { return int(record.updated_wall_ns, false) ?? int(record.started_wall_ns, false) ?? 0n; }
|
|
9
|
+
export function cleanIds(value) { return Array.isArray(value) ? [...new Set(value.filter((item) => typeof item === 'string' && Boolean(item)))].slice(-MAX_AGENT_HISTORY) : []; }
|
|
10
|
+
export function rememberId(record, field, value) {
|
|
11
|
+
const values = (record[field] ??= []);
|
|
12
|
+
if (values.includes(value))
|
|
13
|
+
return false;
|
|
14
|
+
values.push(value);
|
|
15
|
+
if (values.length > MAX_AGENT_HISTORY)
|
|
16
|
+
values.splice(0, values.length - MAX_AGENT_HISTORY);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
export function agentNotificationId(content) {
|
|
20
|
+
return typeof content === 'string' ? content.match(/^[\p{White_Space}\x1c-\x1f]*<task-notification>[\p{White_Space}\x1c-\x1f]*<task-id>([^<>\p{White_Space}\x1c-\x1f]+)<\/task-id>/u)?.[1] ?? null : null;
|
|
21
|
+
}
|
|
22
|
+
export function cleanActiveAgents(value) {
|
|
23
|
+
if (!object(value))
|
|
24
|
+
return {};
|
|
25
|
+
return orderedRecord(Object.entries(value).filter(([id]) => Boolean(id)).map(([id, raw]) => {
|
|
26
|
+
const details = object(raw) ? raw : {};
|
|
27
|
+
return [id, { agent_type: truth(details.agent_type) ? string(details.agent_type) : 'Agent', started_wall_ns: int(details.started_wall_ns, false) ?? 0n }];
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
export function elapsedNs(record, wall, boot, domain) {
|
|
31
|
+
const start = int(record.started_wall_ns), end = int(wall);
|
|
32
|
+
if (start === null || end === null)
|
|
33
|
+
return null;
|
|
34
|
+
return delta({ wall_ns: start, boot_ns: int(record.started_boot_ns), boot_id: typeof record.boot_id === 'string' ? record.boot_id : null }, { wall_ns: end, boot_ns: int(boot), boot_id: typeof domain === 'string' ? domain : null });
|
|
35
|
+
}
|
|
36
|
+
export function cleanRecord(record) {
|
|
37
|
+
if (!object(record) || !truth(record.prompt_id))
|
|
38
|
+
return null;
|
|
39
|
+
const cleaned = Object.fromEntries(TURN_FIELDS.map(key => [key, record[key] ?? null]));
|
|
40
|
+
cleaned.prompt_id = string(record.prompt_id);
|
|
41
|
+
cleaned.status = truth(cleaned.status) ? string(cleaned.status) : 'unknown';
|
|
42
|
+
cleaned.phase = ['main', 'waiting_subagents', 'resuming_main', 'stop_pending'].includes(cleaned.phase) ? cleaned.phase : 'main';
|
|
43
|
+
cleaned.had_subagents = truth(cleaned.had_subagents);
|
|
44
|
+
cleaned.active_agents = cleanActiveAgents(cleaned.active_agents);
|
|
45
|
+
for (const field of ['agent_ids', 'prompt_aliases', 'pending_agent_reports'])
|
|
46
|
+
cleaned[field] = cleanIds(cleaned[field]);
|
|
47
|
+
cleaned.report_aliases = cleanIds(cleaned.report_aliases ?? record.prompt_aliases);
|
|
48
|
+
for (const agent of Object.keys(cleaned.active_agents))
|
|
49
|
+
rememberId(cleaned, 'agent_ids', agent);
|
|
50
|
+
cleaned.native_turns = object(cleaned.native_turns) ? cleaned.native_turns : {};
|
|
51
|
+
cleaned.active_coverage = truth(cleaned.active_coverage) ? cleaned.active_coverage : 'not_observed';
|
|
52
|
+
cleaned.native_wait_seen = cleanIds(cleaned.native_wait_seen);
|
|
53
|
+
cleaned.submission_verified = cleaned.submission_verified === true;
|
|
54
|
+
cleaned.historical_frozen = cleaned.historical_frozen === true;
|
|
55
|
+
if (cleaned.status !== 'running') {
|
|
56
|
+
cleaned.active_agents = {};
|
|
57
|
+
if (int(cleaned.duration_ns, false) === null)
|
|
58
|
+
cleaned.duration_ns = elapsedNs(cleaned, cleaned.ended_wall_ns, cleaned.ended_boot_ns, cleaned.boot_id);
|
|
59
|
+
cleaned.duration_source = truth(cleaned.duration_source) ? cleaned.duration_source : 'legacy';
|
|
60
|
+
}
|
|
61
|
+
return cleaned;
|
|
62
|
+
}
|
|
63
|
+
export function legacyRecord(state, historical = false) {
|
|
64
|
+
if (!object(state) || !truth(state.prompt_id))
|
|
65
|
+
return null;
|
|
66
|
+
const record = Object.fromEntries(TURN_FIELDS.map(key => [key, state[key] ?? null]));
|
|
67
|
+
record.prompt_id = string(record.prompt_id);
|
|
68
|
+
record.status = truth(record.status) ? string(record.status) : 'unknown';
|
|
69
|
+
if (historical && record.status !== 'running' && int(record.duration_ns) !== null)
|
|
70
|
+
record.historical_frozen = true;
|
|
71
|
+
if (!truth(record.start_source))
|
|
72
|
+
record.start_source = 'legacy';
|
|
73
|
+
if (record.status !== 'running' && !truth(record.end_source))
|
|
74
|
+
record.end_source = 'legacy';
|
|
75
|
+
return cleanRecord(record);
|
|
76
|
+
}
|
|
77
|
+
export function pruneTurns(store) {
|
|
78
|
+
if (!Array.isArray(store.turns)) {
|
|
79
|
+
store.turns = [];
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
store.turns.sort((a, b) => compareInt(recordKey(a), recordKey(b)));
|
|
83
|
+
if (store.turns.length <= MAX_TURNS_PER_SESSION)
|
|
84
|
+
return;
|
|
85
|
+
const kept = store.turns.slice(-MAX_TURNS_PER_SESSION), current = store.current_prompt_id;
|
|
86
|
+
if (current && !kept.some(item => item.prompt_id === current)) {
|
|
87
|
+
const record = store.turns.find(item => item.prompt_id === current);
|
|
88
|
+
if (record) {
|
|
89
|
+
kept[0] = record;
|
|
90
|
+
kept.sort((a, b) => compareInt(recordKey(a), recordKey(b)));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
store.turns = kept;
|
|
94
|
+
}
|
|
95
|
+
export function storeFromState(raw, sessionId) {
|
|
96
|
+
const state = object(raw) ? raw : {}, lifecycle = state.lifecycle;
|
|
97
|
+
const turns = [];
|
|
98
|
+
let current = null;
|
|
99
|
+
const historical = !object(lifecycle) || numeric(lifecycle.schema) !== LIFECYCLE_SCHEMA;
|
|
100
|
+
if (object(lifecycle) && [2, 3, LIFECYCLE_SCHEMA].includes(numeric(lifecycle.schema) ?? -1) && Array.isArray(lifecycle.turns)) {
|
|
101
|
+
const seen = new Set();
|
|
102
|
+
for (const item of lifecycle.turns) {
|
|
103
|
+
const record = cleanRecord(item);
|
|
104
|
+
if (!record || seen.has(record.prompt_id))
|
|
105
|
+
continue;
|
|
106
|
+
seen.add(record.prompt_id);
|
|
107
|
+
if (historical && record.status !== 'running' && int(record.duration_ns) !== null)
|
|
108
|
+
record.historical_frozen = true;
|
|
109
|
+
turns.push(record);
|
|
110
|
+
}
|
|
111
|
+
current = truth(lifecycle.current_prompt_id) ? string(lifecycle.current_prompt_id) : null;
|
|
112
|
+
for (const source of [state.previous_running, state]) {
|
|
113
|
+
const legacy = legacyRecord(source, historical);
|
|
114
|
+
if (!legacy)
|
|
115
|
+
continue;
|
|
116
|
+
const index = turns.findIndex(item => item.prompt_id === legacy.prompt_id);
|
|
117
|
+
if (index < 0)
|
|
118
|
+
turns.push(legacy);
|
|
119
|
+
else if (recordKey(legacy) > recordKey(turns[index]))
|
|
120
|
+
turns[index] = legacy;
|
|
121
|
+
}
|
|
122
|
+
const top = legacyRecord(state);
|
|
123
|
+
if (top && recordKey(top) >= (int(lifecycle.updated_wall_ns, false) ?? 0n))
|
|
124
|
+
current = top.prompt_id;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const previous = legacyRecord(state.previous_running, historical);
|
|
128
|
+
if (previous)
|
|
129
|
+
turns.push(previous);
|
|
130
|
+
const record = legacyRecord(state, historical);
|
|
131
|
+
if (record) {
|
|
132
|
+
if (!turns.some(item => item.prompt_id === record.prompt_id))
|
|
133
|
+
turns.push(record);
|
|
134
|
+
current = record.prompt_id;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const store = { schema: LIFECYCLE_SCHEMA, session_id: string(sessionId), current_prompt_id: current, turns, updated_wall_ns: maxInt(turns.map(recordKey)) };
|
|
138
|
+
pruneTurns(store);
|
|
139
|
+
return store;
|
|
140
|
+
}
|
|
141
|
+
export function findTurn(store, promptId = null) {
|
|
142
|
+
const explicit = promptId !== null;
|
|
143
|
+
if (promptId === null)
|
|
144
|
+
promptId = store.current_prompt_id;
|
|
145
|
+
const prompt = truth(promptId) ? string(promptId) : null;
|
|
146
|
+
if (prompt) {
|
|
147
|
+
const found = store.turns.find(item => item.prompt_id === prompt || item.prompt_aliases.includes(prompt));
|
|
148
|
+
if (found)
|
|
149
|
+
return found;
|
|
150
|
+
if (explicit)
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return store.turns.reduce((best, item) => !best || recordKey(item) > recordKey(best) ? item : best, null);
|
|
154
|
+
}
|
|
155
|
+
export function newRecord(promptId, clocks, source = 'hook_submit') {
|
|
156
|
+
return {
|
|
157
|
+
prompt_id: string(promptId), status: 'running', started_wall_ns: clocks.wall_ns, started_boot_ns: clocks.boot_ns, ended_wall_ns: null, ended_boot_ns: null,
|
|
158
|
+
duration_ns: null, duration_source: 'task', stop_candidate: null, native_duration_ms: null, native_turns: {}, active_clock: null, active_coverage: 'not_observed',
|
|
159
|
+
submission_verified: source === 'transcript', native_wait_seen: [], historical_frozen: false, agent_ids: [], prompt_aliases: [], report_aliases: [], pending_agent_reports: [],
|
|
160
|
+
boot_id: clocks.boot_id, start_source: source, end_source: null, end_reason: null, error: null, last_assistant_wall_ns: null, updated_wall_ns: clocks.wall_ns,
|
|
161
|
+
phase: 'main', had_subagents: false, active_agents: {},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export function upsertTurn(store, promptId, clocks, source = 'hook_submit') {
|
|
165
|
+
if (!truth(promptId))
|
|
166
|
+
return null;
|
|
167
|
+
const prompt = string(promptId);
|
|
168
|
+
let record = findTurn(store, prompt);
|
|
169
|
+
if (!record) {
|
|
170
|
+
record = newRecord(prompt, clocks, source);
|
|
171
|
+
store.turns.push(record);
|
|
172
|
+
}
|
|
173
|
+
return record;
|
|
174
|
+
}
|
|
175
|
+
export function terminalRecord(store, promptId, clocks) {
|
|
176
|
+
const found = findTurn(store, promptId);
|
|
177
|
+
if (found)
|
|
178
|
+
return found;
|
|
179
|
+
const record = newRecord(promptId, clocks, 'missing_start');
|
|
180
|
+
record.started_wall_ns = null;
|
|
181
|
+
record.started_boot_ns = null;
|
|
182
|
+
record.boot_id = null;
|
|
183
|
+
store.turns.push(record);
|
|
184
|
+
return record;
|
|
185
|
+
}
|
|
186
|
+
export function mirrorState(sessionId, store, preferredPromptId = null) {
|
|
187
|
+
pruneTurns(store);
|
|
188
|
+
const selected = findTurn(store, preferredPromptId);
|
|
189
|
+
if (!selected)
|
|
190
|
+
return null;
|
|
191
|
+
store.updated_wall_ns = maxInt(store.turns.map(recordKey));
|
|
192
|
+
const state = { ...Object.fromEntries(TURN_FIELDS.map(key => [key, selected[key] ?? null])), schema: SCHEMA, session_id: string(sessionId), lifecycle: store };
|
|
193
|
+
const running = store.turns.filter(item => item.status === 'running' && item.prompt_id !== selected.prompt_id);
|
|
194
|
+
if (['ignored', 'withdrawn'].includes(selected.status) && running.length)
|
|
195
|
+
state.previous_running = { ...running.reduce((best, item) => recordKey(item) > recordKey(best) ? item : best) };
|
|
196
|
+
return state;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=model.js.map
|