@namzu/cli 29.1.0 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +296 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/acp.d.ts +20 -2
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/acp.js +42 -5
- package/dist/commands/acp.js.map +1 -1
- package/dist/commands/drain.d.ts.map +1 -1
- package/dist/commands/drain.js +2 -1
- package/dist/commands/drain.js.map +1 -1
- package/dist/commands/exec-json.d.ts.map +1 -1
- package/dist/commands/exec-json.js +24 -1
- package/dist/commands/exec-json.js.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/exec.js +5 -1
- package/dist/commands/exec.js.map +1 -1
- package/dist/commands/prior-messages.d.ts.map +1 -1
- package/dist/commands/prior-messages.js +42 -2
- package/dist/commands/prior-messages.js.map +1 -1
- package/dist/commands/schedule.d.ts.map +1 -1
- package/dist/commands/schedule.js +7 -5
- package/dist/commands/schedule.js.map +1 -1
- package/dist/config/composer-triggers.d.ts +41 -0
- package/dist/config/composer-triggers.d.ts.map +1 -0
- package/dist/config/composer-triggers.js +80 -0
- package/dist/config/composer-triggers.js.map +1 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +58 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +34 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/context/doctrine.d.ts +3 -3
- package/dist/context/doctrine.d.ts.map +1 -1
- package/dist/context/doctrine.js +3 -3
- package/dist/context/doctrine.js.map +1 -1
- package/dist/context/environment.d.ts +26 -3
- package/dist/context/environment.d.ts.map +1 -1
- package/dist/context/environment.js +68 -9
- package/dist/context/environment.js.map +1 -1
- package/dist/context/runtime-message.d.ts.map +1 -1
- package/dist/context/runtime-message.js +4 -0
- package/dist/context/runtime-message.js.map +1 -1
- package/dist/integrations/mcp/servers.d.ts +72 -5
- package/dist/integrations/mcp/servers.d.ts.map +1 -1
- package/dist/integrations/mcp/servers.js +144 -23
- package/dist/integrations/mcp/servers.js.map +1 -1
- package/dist/integrations/notifications/desktop.d.ts +2 -0
- package/dist/integrations/notifications/desktop.d.ts.map +1 -1
- package/dist/integrations/notifications/desktop.js +6 -5
- package/dist/integrations/notifications/desktop.js.map +1 -1
- package/dist/integrations/plugins/runtime.d.ts +10 -2
- package/dist/integrations/plugins/runtime.d.ts.map +1 -1
- package/dist/integrations/plugins/runtime.js +16 -29
- package/dist/integrations/plugins/runtime.js.map +1 -1
- package/dist/integrations/providers/harness-credentials.d.ts +9 -4
- package/dist/integrations/providers/harness-credentials.d.ts.map +1 -1
- package/dist/integrations/providers/harness-credentials.js +16 -8
- package/dist/integrations/providers/harness-credentials.js.map +1 -1
- package/dist/integrations/resident/session-step.d.ts.map +1 -1
- package/dist/integrations/resident/session-step.js +2 -1
- package/dist/integrations/resident/session-step.js.map +1 -1
- package/dist/integrations/sessions/store.d.ts.map +1 -1
- package/dist/integrations/sessions/store.js +20 -2
- package/dist/integrations/sessions/store.js.map +1 -1
- package/dist/integrations/subagents/NamzuCliAgent.d.ts +8 -0
- package/dist/integrations/subagents/NamzuCliAgent.d.ts.map +1 -0
- package/dist/integrations/subagents/NamzuCliAgent.js +9 -0
- package/dist/integrations/subagents/NamzuCliAgent.js.map +1 -0
- package/dist/integrations/subagents/runtime.d.ts +5 -4
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/subagents/runtime.js +46 -11
- package/dist/integrations/subagents/runtime.js.map +1 -1
- package/dist/integrations/web/open-url.d.ts +24 -0
- package/dist/integrations/web/open-url.d.ts.map +1 -0
- package/dist/integrations/web/open-url.js +73 -0
- package/dist/integrations/web/open-url.js.map +1 -0
- package/dist/integrations/web/search.d.ts.map +1 -1
- package/dist/integrations/web/search.js +8 -6
- package/dist/integrations/web/search.js.map +1 -1
- package/dist/permissions/rules.d.ts +5 -1
- package/dist/permissions/rules.d.ts.map +1 -1
- package/dist/permissions/rules.js +85 -3
- package/dist/permissions/rules.js.map +1 -1
- package/dist/schedule/build.d.ts +26 -2
- package/dist/schedule/build.d.ts.map +1 -1
- package/dist/schedule/build.js +139 -20
- package/dist/schedule/build.js.map +1 -1
- package/dist/schedule/changes.d.ts +6 -0
- package/dist/schedule/changes.d.ts.map +1 -1
- package/dist/schedule/changes.js +23 -0
- package/dist/schedule/changes.js.map +1 -1
- package/dist/schedule/commands/add.d.ts +1 -1
- package/dist/schedule/commands/add.d.ts.map +1 -1
- package/dist/schedule/commands/add.js +188 -54
- package/dist/schedule/commands/add.js.map +1 -1
- package/dist/schedule/commands/lifecycle.d.ts.map +1 -1
- package/dist/schedule/commands/lifecycle.js +2 -1
- package/dist/schedule/commands/lifecycle.js.map +1 -1
- package/dist/schedule/commands/list.d.ts +2 -0
- package/dist/schedule/commands/list.d.ts.map +1 -1
- package/dist/schedule/commands/list.js +69 -20
- package/dist/schedule/commands/list.js.map +1 -1
- package/dist/schedule/daemon/daemon.d.ts +1 -1
- package/dist/schedule/daemon/daemon.d.ts.map +1 -1
- package/dist/schedule/daemon/daemon.js +22 -5
- package/dist/schedule/daemon/daemon.js.map +1 -1
- package/dist/schedule/daemon/notify.d.ts +29 -2
- package/dist/schedule/daemon/notify.d.ts.map +1 -1
- package/dist/schedule/daemon/notify.js +71 -2
- package/dist/schedule/daemon/notify.js.map +1 -1
- package/dist/schedule/env.d.ts +8 -4
- package/dist/schedule/env.d.ts.map +1 -1
- package/dist/schedule/env.js +13 -6
- package/dist/schedule/env.js.map +1 -1
- package/dist/schedule/fire/calls.d.ts +49 -0
- package/dist/schedule/fire/calls.d.ts.map +1 -0
- package/dist/schedule/fire/calls.js +114 -0
- package/dist/schedule/fire/calls.js.map +1 -0
- package/dist/schedule/fire/fire.d.ts +1 -1
- package/dist/schedule/fire/fire.d.ts.map +1 -1
- package/dist/schedule/fire/fire.js +209 -15
- package/dist/schedule/fire/fire.js.map +1 -1
- package/dist/schedule/fire/result.d.ts +1 -1
- package/dist/schedule/fire/result.d.ts.map +1 -1
- package/dist/schedule/fire/result.js +2 -1
- package/dist/schedule/fire/result.js.map +1 -1
- package/dist/schedule/fire/run-script.d.ts +46 -0
- package/dist/schedule/fire/run-script.d.ts.map +1 -0
- package/dist/schedule/fire/run-script.js +81 -0
- package/dist/schedule/fire/run-script.js.map +1 -0
- package/dist/schedule/fire/unattended-note.d.ts +8 -0
- package/dist/schedule/fire/unattended-note.d.ts.map +1 -1
- package/dist/schedule/fire/unattended-note.js +5 -0
- package/dist/schedule/fire/unattended-note.js.map +1 -1
- package/dist/schedule/fire/wake-gate.d.ts +39 -0
- package/dist/schedule/fire/wake-gate.d.ts.map +1 -0
- package/dist/schedule/fire/wake-gate.js +90 -0
- package/dist/schedule/fire/wake-gate.js.map +1 -0
- package/dist/schedule/floor.d.ts +28 -8
- package/dist/schedule/floor.d.ts.map +1 -1
- package/dist/schedule/floor.js +624 -114
- package/dist/schedule/floor.js.map +1 -1
- package/dist/schedule/policy.d.ts +40 -0
- package/dist/schedule/policy.d.ts.map +1 -1
- package/dist/schedule/policy.js +36 -0
- package/dist/schedule/policy.js.map +1 -1
- package/dist/schedule/script-check.d.ts +53 -0
- package/dist/schedule/script-check.d.ts.map +1 -0
- package/dist/schedule/script-check.js +145 -0
- package/dist/schedule/script-check.js.map +1 -0
- package/dist/schedule/script-shell.d.ts +3 -0
- package/dist/schedule/script-shell.d.ts.map +1 -0
- package/dist/schedule/script-shell.js +5 -0
- package/dist/schedule/script-shell.js.map +1 -0
- package/dist/schedule/service/index.d.ts +1 -1
- package/dist/schedule/service/index.d.ts.map +1 -1
- package/dist/schedule/service/index.js +20 -11
- package/dist/schedule/service/index.js.map +1 -1
- package/dist/schedule/service/manifest.js +1 -1
- package/dist/schedule/service/manifest.js.map +1 -1
- package/dist/schedule/service/windows-task.d.ts +7 -0
- package/dist/schedule/service/windows-task.d.ts.map +1 -1
- package/dist/schedule/service/windows-task.js +65 -0
- package/dist/schedule/service/windows-task.js.map +1 -1
- package/dist/schedule/service/wsl.d.ts +13 -1
- package/dist/schedule/service/wsl.d.ts.map +1 -1
- package/dist/schedule/service/wsl.js +16 -6
- package/dist/schedule/service/wsl.js.map +1 -1
- package/dist/schedule/store/atomic.d.ts +5 -2
- package/dist/schedule/store/atomic.d.ts.map +1 -1
- package/dist/schedule/store/atomic.js +7 -4
- package/dist/schedule/store/atomic.js.map +1 -1
- package/dist/schedule/store/claims.js +1 -1
- package/dist/schedule/store/claims.js.map +1 -1
- package/dist/schedule/store/history.d.ts +1 -1
- package/dist/schedule/store/history.d.ts.map +1 -1
- package/dist/schedule/store/history.js +4 -1
- package/dist/schedule/store/history.js.map +1 -1
- package/dist/schedule/store/jobs.d.ts +19 -3
- package/dist/schedule/store/jobs.d.ts.map +1 -1
- package/dist/schedule/store/jobs.js +83 -16
- package/dist/schedule/store/jobs.js.map +1 -1
- package/dist/schedule/store/state.js +1 -1
- package/dist/schedule/store/state.js.map +1 -1
- package/dist/schedule/types.d.ts +98 -6
- package/dist/schedule/types.d.ts.map +1 -1
- package/dist/schedule/types.js +25 -1
- package/dist/schedule/types.js.map +1 -1
- package/dist/schedule/visible-source.d.ts +18 -0
- package/dist/schedule/visible-source.d.ts.map +1 -0
- package/dist/schedule/visible-source.js +59 -0
- package/dist/schedule/visible-source.js.map +1 -0
- package/dist/skills/directory.d.ts +38 -0
- package/dist/skills/directory.d.ts.map +1 -0
- package/dist/skills/directory.js +51 -0
- package/dist/skills/directory.js.map +1 -0
- package/dist/test-support/toolset.d.ts +23 -0
- package/dist/test-support/toolset.d.ts.map +1 -0
- package/dist/test-support/toolset.js +27 -0
- package/dist/test-support/toolset.js.map +1 -0
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +343 -64
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/ChoicePicker.d.ts +2 -0
- package/dist/tui/ChoicePicker.d.ts.map +1 -1
- package/dist/tui/ChoicePicker.js +10 -2
- package/dist/tui/ChoicePicker.js.map +1 -1
- package/dist/tui/Composer.d.ts +62 -3
- package/dist/tui/Composer.d.ts.map +1 -1
- package/dist/tui/Composer.js +162 -25
- package/dist/tui/Composer.js.map +1 -1
- package/dist/tui/ComposerFrame.d.ts +1 -1
- package/dist/tui/ComposerFrame.js +3 -3
- package/dist/tui/ComposerFrame.js.map +1 -1
- package/dist/tui/EffortSlider.d.ts +8 -9
- package/dist/tui/EffortSlider.d.ts.map +1 -1
- package/dist/tui/EffortSlider.js +15 -12
- package/dist/tui/EffortSlider.js.map +1 -1
- package/dist/tui/PermissionOverlay.d.ts +13 -1
- package/dist/tui/PermissionOverlay.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.js +26 -4
- package/dist/tui/PermissionOverlay.js.map +1 -1
- package/dist/tui/StatusBar.d.ts +12 -12
- package/dist/tui/StatusBar.d.ts.map +1 -1
- package/dist/tui/StatusBar.js +15 -15
- package/dist/tui/StatusBar.js.map +1 -1
- package/dist/tui/agent.d.ts +73 -12
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +430 -180
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/hypermode.d.ts +37 -0
- package/dist/tui/hypermode.d.ts.map +1 -0
- package/dist/tui/hypermode.js +58 -0
- package/dist/tui/hypermode.js.map +1 -0
- package/dist/tui/open-browser.d.ts +29 -1
- package/dist/tui/open-browser.d.ts.map +1 -1
- package/dist/tui/open-browser.js +83 -11
- package/dist/tui/open-browser.js.map +1 -1
- package/dist/tui/permission-review.d.ts +11 -2
- package/dist/tui/permission-review.d.ts.map +1 -1
- package/dist/tui/permission-review.js +176 -19
- package/dist/tui/permission-review.js.map +1 -1
- package/dist/tui/schedule/host-commands.d.ts.map +1 -1
- package/dist/tui/schedule/host-commands.js +95 -33
- package/dist/tui/schedule/host-commands.js.map +1 -1
- package/dist/tui/schedule/integration.d.ts +6 -2
- package/dist/tui/schedule/integration.d.ts.map +1 -1
- package/dist/tui/schedule/integration.js +3 -1
- package/dist/tui/schedule/integration.js.map +1 -1
- package/dist/tui/schedule/resume.d.ts.map +1 -1
- package/dist/tui/schedule/resume.js +10 -1
- package/dist/tui/schedule/resume.js.map +1 -1
- package/dist/tui/schedule/tool-host.d.ts +18 -1
- package/dist/tui/schedule/tool-host.d.ts.map +1 -1
- package/dist/tui/schedule/tool-host.js +384 -84
- package/dist/tui/schedule/tool-host.js.map +1 -1
- package/dist/tui/slashCommands.d.ts +23 -5
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +80 -31
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/theme.d.ts +10 -4
- package/dist/tui/theme.d.ts.map +1 -1
- package/dist/tui/theme.js +4 -3
- package/dist/tui/theme.js.map +1 -1
- package/dist/tui/triggers/analyze.d.ts +57 -0
- package/dist/tui/triggers/analyze.d.ts.map +1 -0
- package/dist/tui/triggers/analyze.js +221 -0
- package/dist/tui/triggers/analyze.js.map +1 -0
- package/dist/tui/triggers/context-text.d.ts +21 -0
- package/dist/tui/triggers/context-text.d.ts.map +1 -0
- package/dist/tui/triggers/context-text.js +44 -0
- package/dist/tui/triggers/context-text.js.map +1 -0
- package/dist/tui/triggers/copy.d.ts +38 -0
- package/dist/tui/triggers/copy.d.ts.map +1 -0
- package/dist/tui/triggers/copy.js +163 -0
- package/dist/tui/triggers/copy.js.map +1 -0
- package/dist/tui/triggers/detect.d.ts +83 -0
- package/dist/tui/triggers/detect.d.ts.map +1 -0
- package/dist/tui/triggers/detect.js +295 -0
- package/dist/tui/triggers/detect.js.map +1 -0
- package/dist/tui/triggers/fold.d.ts +34 -0
- package/dist/tui/triggers/fold.d.ts.map +1 -0
- package/dist/tui/triggers/fold.js +44 -0
- package/dist/tui/triggers/fold.js.map +1 -0
- package/dist/tui/triggers/pattern.d.ts +66 -0
- package/dist/tui/triggers/pattern.d.ts.map +1 -0
- package/dist/tui/triggers/pattern.js +243 -0
- package/dist/tui/triggers/pattern.js.map +1 -0
- package/dist/tui/triggers/provenance.d.ts +58 -0
- package/dist/tui/triggers/provenance.d.ts.map +1 -0
- package/dist/tui/triggers/provenance.js +98 -0
- package/dist/tui/triggers/provenance.js.map +1 -0
- package/dist/tui/triggers/registry.d.ts +113 -0
- package/dist/tui/triggers/registry.d.ts.map +1 -0
- package/dist/tui/triggers/registry.js +164 -0
- package/dist/tui/triggers/registry.js.map +1 -0
- package/dist/tui/triggers/setting.d.ts +18 -0
- package/dist/tui/triggers/setting.d.ts.map +1 -0
- package/dist/tui/triggers/setting.js +61 -0
- package/dist/tui/triggers/setting.js.map +1 -0
- package/dist/tui/triggers/verbs.d.ts +29 -0
- package/dist/tui/triggers/verbs.d.ts.map +1 -0
- package/dist/tui/triggers/verbs.js +140 -0
- package/dist/tui/triggers/verbs.js.map +1 -0
- package/dist/tui/types.d.ts +3 -1
- package/dist/tui/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/skills/README.md +5 -0
- package/skills/schedule-task/SKILL.md +123 -5
package/dist/tui/theme.d.ts
CHANGED
|
@@ -20,11 +20,17 @@ export interface SemanticColors {
|
|
|
20
20
|
readonly system: string;
|
|
21
21
|
readonly tool: string;
|
|
22
22
|
/**
|
|
23
|
-
* The
|
|
23
|
+
* The hypermode session mode's own colour (violet), used wherever the
|
|
24
24
|
* mode is named: the effort slider's last stop, the message box's top
|
|
25
25
|
* border tag and the footer segment. Never a status colour.
|
|
26
26
|
*/
|
|
27
|
-
readonly
|
|
27
|
+
readonly hypermode: string;
|
|
28
|
+
/**
|
|
29
|
+
* An armed composer trigger (sky): its words in the draft and its tag
|
|
30
|
+
* row. Kept apart from the session mode's violet, which names what lasts
|
|
31
|
+
* for the session; a trigger lasts one message.
|
|
32
|
+
*/
|
|
33
|
+
readonly trigger: string;
|
|
28
34
|
};
|
|
29
35
|
readonly status: {
|
|
30
36
|
readonly ok: string;
|
|
@@ -39,9 +45,9 @@ export interface SemanticColors {
|
|
|
39
45
|
export declare const theme: SemanticColors;
|
|
40
46
|
/**
|
|
41
47
|
* The still colour run drawn across the message box's top rule while
|
|
42
|
-
*
|
|
48
|
+
* hypermode is on, applied one cell at a time and repeated. Static by
|
|
43
49
|
* design: it is never animated, and a renderer without colour draws the plain
|
|
44
50
|
* rule instead.
|
|
45
51
|
*/
|
|
46
|
-
export declare const
|
|
52
|
+
export declare const HYPERMODE_RULE_COLORS: readonly string[];
|
|
47
53
|
//# sourceMappingURL=theme.d.ts.map
|
package/dist/tui/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/tui/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,cAAc;IAC9B,qDAAqD;IACrD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE;QACd,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,QAAQ,CAAC,MAAM,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB;;;;WAIG;QACH,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/tui/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,cAAc;IAC9B,qDAAqD;IACrD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE;QACd,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,QAAQ,CAAC,MAAM,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB;;;;WAIG;QACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B;;;;WAIG;QACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KACxB,CAAA;IACD,QAAQ,CAAC,MAAM,EAAE;QAChB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,QAAQ,CAAC,MAAM,EAAE;QAChB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KACtB,CAAA;CACD;AAED,eAAO,MAAM,KAAK,EAAE,cAwBnB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAQlD,CAAA"}
|
package/dist/tui/theme.js
CHANGED
|
@@ -18,7 +18,8 @@ export const theme = {
|
|
|
18
18
|
assistant: 'ansi256(83)',
|
|
19
19
|
system: 'ansi256(109)',
|
|
20
20
|
tool: 'ansi256(248)',
|
|
21
|
-
|
|
21
|
+
hypermode: 'ansi256(141)',
|
|
22
|
+
trigger: 'ansi256(117)',
|
|
22
23
|
},
|
|
23
24
|
status: {
|
|
24
25
|
ok: 'ansi256(77)',
|
|
@@ -32,11 +33,11 @@ export const theme = {
|
|
|
32
33
|
};
|
|
33
34
|
/**
|
|
34
35
|
* The still colour run drawn across the message box's top rule while
|
|
35
|
-
*
|
|
36
|
+
* hypermode is on, applied one cell at a time and repeated. Static by
|
|
36
37
|
* design: it is never animated, and a renderer without colour draws the plain
|
|
37
38
|
* rule instead.
|
|
38
39
|
*/
|
|
39
|
-
export const
|
|
40
|
+
export const HYPERMODE_RULE_COLORS = [
|
|
40
41
|
'ansi256(110)',
|
|
41
42
|
'ansi256(140)',
|
|
42
43
|
'ansi256(175)',
|
package/dist/tui/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/tui/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/tui/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuCH,MAAM,CAAC,MAAM,KAAK,GAAmB;IACpC,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE;QACL,OAAO,EAAE,cAAc;QACvB,SAAS,EAAE,cAAc;QACzB,KAAK,EAAE,cAAc;KACrB;IACD,MAAM,EAAE;QACP,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,aAAa;QACxB,MAAM,EAAE,cAAc;QACtB,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,cAAc;QACzB,OAAO,EAAE,cAAc;KACvB;IACD,MAAM,EAAE;QACP,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,cAAc;KACrB;IACD,MAAM,EAAE;QACP,OAAO,EAAE,cAAc;QACvB,KAAK,EAAE,aAAa;KACpB;CACD,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACvD,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;CACd,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A draft read the way the trigger matcher needs it: word tokens with their
|
|
3
|
+
* place in the draft, the clauses they fall in, and the stretches of text
|
|
4
|
+
* that are not the operator speaking in their own words.
|
|
5
|
+
*
|
|
6
|
+
* - Tokens come from one regular expression over the folded text
|
|
7
|
+
* (`fold.ts`): runs of letters, digits and `_`, joined across an inner
|
|
8
|
+
* apostrophe, so `skill'e` and `don't` are one token each and `e-posta`
|
|
9
|
+
* is two. No `Intl.Segmenter` word mode, whose answers depend on the ICU
|
|
10
|
+
* build.
|
|
11
|
+
* - A clause ends at `.`, `;`, `!`, `?`, `…`, a comma, a colon, a bracket, a
|
|
12
|
+
* newline, an en or em dash, or a hyphen with space on both sides. A hyphen
|
|
13
|
+
* inside a word (`e-posta`, `sub-agents`) is not an edge.
|
|
14
|
+
* - An exclusion zone is code (`` `…` `` and fenced blocks), a quotation
|
|
15
|
+
* (`"…"`, `“…”`, `«…»`, `‘…’`, and `'…'` where the `'` stands at a word
|
|
16
|
+
* edge, so `skill'e` is not a quote), a URL, an `@mention`, anything
|
|
17
|
+
* path-like, and a line that starts with `>`. An opener with no closer
|
|
18
|
+
* excludes everything after it. Tokens inside a zone stay in the stream as
|
|
19
|
+
* words — they still decide where a clause begins and ends — but no match
|
|
20
|
+
* may touch one.
|
|
21
|
+
*
|
|
22
|
+
* Pure. Offsets are UTF-16 code units of the draft.
|
|
23
|
+
*/
|
|
24
|
+
export interface Token {
|
|
25
|
+
/** Folded text. */
|
|
26
|
+
readonly text: string;
|
|
27
|
+
/** Offsets in the draft. */
|
|
28
|
+
readonly start: number;
|
|
29
|
+
readonly end: number;
|
|
30
|
+
/** The clause this token belongs to. */
|
|
31
|
+
readonly clause: number;
|
|
32
|
+
/** A clause edge (or the start of the draft) lies between the previous token and this one. */
|
|
33
|
+
readonly edgeBefore: boolean;
|
|
34
|
+
/** A clause edge (or the end of the draft) lies between this token and the next. */
|
|
35
|
+
readonly edgeAfter: boolean;
|
|
36
|
+
/** The text between this token and the next contains a `:`. */
|
|
37
|
+
readonly colonAfter: boolean;
|
|
38
|
+
/** Inside an exclusion zone. */
|
|
39
|
+
readonly excluded: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface Clause {
|
|
42
|
+
readonly first: number;
|
|
43
|
+
readonly last: number;
|
|
44
|
+
/** The clause is ended by a `?`. */
|
|
45
|
+
readonly question: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface Analysis {
|
|
48
|
+
readonly tokens: readonly Token[];
|
|
49
|
+
readonly clauses: readonly Clause[];
|
|
50
|
+
/** Draft ranges no match may overlap. */
|
|
51
|
+
readonly zones: readonly (readonly [number, number])[];
|
|
52
|
+
}
|
|
53
|
+
export declare function analyze(draft: string): Analysis;
|
|
54
|
+
/** Whether `[start, end)` of the draft touches an exclusion zone. */
|
|
55
|
+
export declare function inZone(analysis: Analysis, start: number, end: number): boolean;
|
|
56
|
+
export declare function exclusionZones(draft: string): Array<readonly [number, number]>;
|
|
57
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../src/tui/triggers/analyze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,MAAM,WAAW,KAAK;IACrB,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,wCAAwC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,8FAA8F;IAC9F,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,gCAAgC;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,WAAW,MAAM;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,oCAAoC;IACpC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAA;CACtD;AAYD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAsD/C;AAMD,qEAAqE;AACrE,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAY9E;AA8BD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkB9E"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A draft read the way the trigger matcher needs it: word tokens with their
|
|
3
|
+
* place in the draft, the clauses they fall in, and the stretches of text
|
|
4
|
+
* that are not the operator speaking in their own words.
|
|
5
|
+
*
|
|
6
|
+
* - Tokens come from one regular expression over the folded text
|
|
7
|
+
* (`fold.ts`): runs of letters, digits and `_`, joined across an inner
|
|
8
|
+
* apostrophe, so `skill'e` and `don't` are one token each and `e-posta`
|
|
9
|
+
* is two. No `Intl.Segmenter` word mode, whose answers depend on the ICU
|
|
10
|
+
* build.
|
|
11
|
+
* - A clause ends at `.`, `;`, `!`, `?`, `…`, a comma, a colon, a bracket, a
|
|
12
|
+
* newline, an en or em dash, or a hyphen with space on both sides. A hyphen
|
|
13
|
+
* inside a word (`e-posta`, `sub-agents`) is not an edge.
|
|
14
|
+
* - An exclusion zone is code (`` `…` `` and fenced blocks), a quotation
|
|
15
|
+
* (`"…"`, `“…”`, `«…»`, `‘…’`, and `'…'` where the `'` stands at a word
|
|
16
|
+
* edge, so `skill'e` is not a quote), a URL, an `@mention`, anything
|
|
17
|
+
* path-like, and a line that starts with `>`. An opener with no closer
|
|
18
|
+
* excludes everything after it. Tokens inside a zone stay in the stream as
|
|
19
|
+
* words — they still decide where a clause begins and ends — but no match
|
|
20
|
+
* may touch one.
|
|
21
|
+
*
|
|
22
|
+
* Pure. Offsets are UTF-16 code units of the draft.
|
|
23
|
+
*/
|
|
24
|
+
import { foldWithMap } from './fold.js';
|
|
25
|
+
const WORD = /[\p{L}\p{N}_]+(?:'[\p{L}\p{N}_]+)*/gu;
|
|
26
|
+
/** Characters that end a clause wherever they stand. */
|
|
27
|
+
const EDGE_CHARACTERS = /[.;!?…,:()[\]{}\n–—]/u;
|
|
28
|
+
/**
|
|
29
|
+
* A hyphen (or two) with space on both sides: `fix it - then ship`. The gap
|
|
30
|
+
* between two tokens is only the text between them, so a bare `-` there is
|
|
31
|
+
* a hyphen inside a word (`e-posta`), not an edge.
|
|
32
|
+
*/
|
|
33
|
+
const SPACED_HYPHEN = /\s-{1,2}\s/u;
|
|
34
|
+
export function analyze(draft) {
|
|
35
|
+
const folded = foldWithMap(draft);
|
|
36
|
+
const zones = mergeZones(exclusionZones(draft));
|
|
37
|
+
let zone = 0;
|
|
38
|
+
const raw = [];
|
|
39
|
+
for (const match of folded.text.matchAll(WORD)) {
|
|
40
|
+
const fStart = match.index;
|
|
41
|
+
const fEnd = fStart + match[0].length;
|
|
42
|
+
raw.push({
|
|
43
|
+
text: match[0],
|
|
44
|
+
fStart,
|
|
45
|
+
fEnd,
|
|
46
|
+
start: folded.map[fStart] ?? 0,
|
|
47
|
+
end: folded.map[fEnd] ?? draft.length,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const tokens = [];
|
|
51
|
+
const clauses = [];
|
|
52
|
+
let clause = 0;
|
|
53
|
+
let clauseFirst = 0;
|
|
54
|
+
for (let index = 0; index < raw.length; index += 1) {
|
|
55
|
+
const token = raw[index];
|
|
56
|
+
if (!token)
|
|
57
|
+
continue;
|
|
58
|
+
const previous = raw[index - 1];
|
|
59
|
+
const next = raw[index + 1];
|
|
60
|
+
const gapBefore = previous ? folded.text.slice(previous.fEnd, token.fStart) : '';
|
|
61
|
+
const gapAfter = folded.text.slice(token.fEnd, next ? next.fStart : folded.text.length);
|
|
62
|
+
const edgeBefore = !previous || isEdge(gapBefore);
|
|
63
|
+
const edgeAfter = !next || isEdge(gapAfter);
|
|
64
|
+
if (edgeBefore && index > 0) {
|
|
65
|
+
clauses.push({ first: clauseFirst, last: index - 1, question: gapBefore.includes('?') });
|
|
66
|
+
clause += 1;
|
|
67
|
+
clauseFirst = index;
|
|
68
|
+
}
|
|
69
|
+
// Tokens and merged zones both run left to right: one pass.
|
|
70
|
+
while (zone < zones.length && (zones[zone]?.[1] ?? 0) <= token.start)
|
|
71
|
+
zone += 1;
|
|
72
|
+
const current = zones[zone];
|
|
73
|
+
tokens.push({
|
|
74
|
+
text: token.text,
|
|
75
|
+
start: token.start,
|
|
76
|
+
end: token.end,
|
|
77
|
+
clause,
|
|
78
|
+
edgeBefore,
|
|
79
|
+
edgeAfter,
|
|
80
|
+
colonAfter: gapAfter.includes(':'),
|
|
81
|
+
excluded: current !== undefined && token.start < current[1] && token.end > current[0],
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (raw.length > 0) {
|
|
85
|
+
const last = raw[raw.length - 1];
|
|
86
|
+
const tail = last ? folded.text.slice(last.fEnd) : '';
|
|
87
|
+
clauses.push({ first: clauseFirst, last: raw.length - 1, question: tail.includes('?') });
|
|
88
|
+
}
|
|
89
|
+
return { tokens, clauses, zones };
|
|
90
|
+
}
|
|
91
|
+
function isEdge(gap) {
|
|
92
|
+
return EDGE_CHARACTERS.test(gap) || SPACED_HYPHEN.test(gap);
|
|
93
|
+
}
|
|
94
|
+
/** Whether `[start, end)` of the draft touches an exclusion zone. */
|
|
95
|
+
export function inZone(analysis, start, end) {
|
|
96
|
+
// Zones are merged and sorted: find the first one ending after `start`.
|
|
97
|
+
const zones = analysis.zones;
|
|
98
|
+
let low = 0;
|
|
99
|
+
let high = zones.length;
|
|
100
|
+
while (low < high) {
|
|
101
|
+
const middle = (low + high) >> 1;
|
|
102
|
+
if ((zones[middle]?.[1] ?? 0) <= start)
|
|
103
|
+
low = middle + 1;
|
|
104
|
+
else
|
|
105
|
+
high = middle;
|
|
106
|
+
}
|
|
107
|
+
const zone = zones[low];
|
|
108
|
+
return zone !== undefined && zone[0] < end;
|
|
109
|
+
}
|
|
110
|
+
/** Sorted, non-overlapping. */
|
|
111
|
+
function mergeZones(zones) {
|
|
112
|
+
const sorted = [...zones].sort((a, b) => a[0] - b[0]);
|
|
113
|
+
const merged = [];
|
|
114
|
+
for (const [from, to] of sorted) {
|
|
115
|
+
const last = merged[merged.length - 1];
|
|
116
|
+
if (last && from <= last[1])
|
|
117
|
+
last[1] = Math.max(last[1], to);
|
|
118
|
+
else
|
|
119
|
+
merged.push([from, to]);
|
|
120
|
+
}
|
|
121
|
+
return merged;
|
|
122
|
+
}
|
|
123
|
+
// ---------------------------------------------------------------------------
|
|
124
|
+
// exclusion zones
|
|
125
|
+
const PAIRS = [
|
|
126
|
+
['“', '”'],
|
|
127
|
+
['«', '»'],
|
|
128
|
+
['‘', '’'],
|
|
129
|
+
];
|
|
130
|
+
const URL = /\b(?:[a-z][a-z0-9+.-]*:\/\/|www\.)\S+/giu;
|
|
131
|
+
const MENTION = /(?<![\p{L}\p{N}_])@[\w./~-]+/gu;
|
|
132
|
+
/** A run of non-space characters with a slash or backslash in it, or a `name.ext`. */
|
|
133
|
+
const PATH_LIKE = /[^\s"'`“”«»‘’()]*[/\\][^\s"'`“”«»‘’()]*|(?<![\p{L}\p{N}_])[\p{L}\p{N}_-]+\.[a-z][a-z0-9]{0,5}(?![\p{L}\p{N}_])/giu;
|
|
134
|
+
export function exclusionZones(draft) {
|
|
135
|
+
const zones = [];
|
|
136
|
+
// Code first: a quote inside code is code, and a backtick inside a quote
|
|
137
|
+
// is still the operator's quotation.
|
|
138
|
+
scanDelimited(draft, zones);
|
|
139
|
+
for (const pattern of [URL, MENTION, PATH_LIKE]) {
|
|
140
|
+
for (const match of draft.matchAll(pattern)) {
|
|
141
|
+
if (match[0].length === 0)
|
|
142
|
+
continue;
|
|
143
|
+
zones.push([match.index, match.index + match[0].length]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// A line quoted with `>` is somebody else's text.
|
|
147
|
+
let lineStart = 0;
|
|
148
|
+
for (const line of draft.split('\n')) {
|
|
149
|
+
if (/^\s*>/u.test(line))
|
|
150
|
+
zones.push([lineStart, lineStart + line.length]);
|
|
151
|
+
lineStart += line.length + 1;
|
|
152
|
+
}
|
|
153
|
+
return zones;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Code spans, fenced blocks and quotations, left to right. Each opener runs
|
|
157
|
+
* to its closer; an opener with no closer runs to the end of the draft.
|
|
158
|
+
*/
|
|
159
|
+
function scanDelimited(draft, zones) {
|
|
160
|
+
let index = 0;
|
|
161
|
+
while (index < draft.length) {
|
|
162
|
+
const char = draft[index] ?? '';
|
|
163
|
+
if (draft.startsWith('```', index)) {
|
|
164
|
+
const close = draft.indexOf('```', index + 3);
|
|
165
|
+
const end = close < 0 ? draft.length : close + 3;
|
|
166
|
+
zones.push([index, end]);
|
|
167
|
+
index = end;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (char === '`') {
|
|
171
|
+
const close = draft.indexOf('`', index + 1);
|
|
172
|
+
const end = close < 0 ? draft.length : close + 1;
|
|
173
|
+
zones.push([index, end]);
|
|
174
|
+
index = end;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (char === '"') {
|
|
178
|
+
const close = draft.indexOf('"', index + 1);
|
|
179
|
+
const end = close < 0 ? draft.length : close + 1;
|
|
180
|
+
zones.push([index, end]);
|
|
181
|
+
index = end;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const pair = PAIRS.find(([open]) => open === char);
|
|
185
|
+
if (pair) {
|
|
186
|
+
const close = draft.indexOf(pair[1], index + 1);
|
|
187
|
+
const end = close < 0 ? draft.length : close + 1;
|
|
188
|
+
zones.push([index, end]);
|
|
189
|
+
index = end;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (char === "'" && opensQuote(draft, index)) {
|
|
193
|
+
let close = -1;
|
|
194
|
+
for (let at = index + 1; at < draft.length; at += 1) {
|
|
195
|
+
if (draft[at] === "'" && closesQuote(draft, at)) {
|
|
196
|
+
close = at;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const end = close < 0 ? draft.length : close + 1;
|
|
201
|
+
zones.push([index, end]);
|
|
202
|
+
index = end;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
index += 1;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const LETTER = /[\p{L}\p{N}_]/u;
|
|
209
|
+
/** An ASCII `'` opens a quotation only at the start of a word: nothing word-like before it, something after. */
|
|
210
|
+
function opensQuote(draft, index) {
|
|
211
|
+
const before = draft[index - 1];
|
|
212
|
+
const after = draft[index + 1];
|
|
213
|
+
return (before === undefined || !LETTER.test(before)) && after !== undefined && !/\s/u.test(after);
|
|
214
|
+
}
|
|
215
|
+
/** …and closes one only at the end of a word: something before it, nothing word-like after. */
|
|
216
|
+
function closesQuote(draft, index) {
|
|
217
|
+
const before = draft[index - 1];
|
|
218
|
+
const after = draft[index + 1];
|
|
219
|
+
return before !== undefined && !/\s/u.test(before) && (after === undefined || !LETTER.test(after));
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=analyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.js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CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;YACxB,KAAK,GAAG,GAAG,CAAA;YACX,SAAQ;QACT,CAAC;QACD,KAAK,IAAI,CAAC,CAAA;IACX,CAAC;AACF,CAAC;AAED,MAAM,MAAM,GAAG,gBAAgB,CAAA;AAE/B,gHAAgH;AAChH,SAAS,UAAU,CAAC,KAAa,EAAE,KAAa;IAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC9B,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACnG,CAAC;AAED,+FAA+F;AAC/F,SAAS,WAAW,CAAC,KAAa,EAAE,KAAa;IAChD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC9B,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;AACnG,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What namzu tells the model, in its own words, for a trigger the operator
|
|
3
|
+
* armed. Fixed text per trigger: operator text never enters it.
|
|
4
|
+
*
|
|
5
|
+
* It travels as a request-only `context` prompt contribution
|
|
6
|
+
* (`SendOptions.hostContext` in `../agent.ts`): after the history, never in
|
|
7
|
+
* it, and never in the system prompt, which is the cached prefix. The
|
|
8
|
+
* operator's message itself reaches the model and the session log unchanged.
|
|
9
|
+
*/
|
|
10
|
+
import type { ReasoningEffort } from '@namzu/sdk';
|
|
11
|
+
import type { TriggerId } from './registry.js';
|
|
12
|
+
/** The context texts for the armed triggers of one turn, in a fixed order. */
|
|
13
|
+
export declare function triggerContextTexts(ids: readonly TriggerId[]): string[];
|
|
14
|
+
/**
|
|
15
|
+
* The effort the armed triggers pin for their turn, on a model that
|
|
16
|
+
* publishes `levels`: the highest level for max effort, else the level
|
|
17
|
+
* hypermode pins (`xhigh`, or the nearest below it). `undefined` when none
|
|
18
|
+
* pins one, or the model publishes no menu.
|
|
19
|
+
*/
|
|
20
|
+
export declare function triggerEffort(ids: readonly TriggerId[], levels: readonly ReasoningEffort[] | undefined): ReasoningEffort | undefined;
|
|
21
|
+
//# sourceMappingURL=context-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-text.d.ts","sourceRoot":"","sources":["../../../src/tui/triggers/context-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAGjD,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,eAAe,CAAA;AAY7D,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,EAAE,CAUvE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,GAAG,EAAE,SAAS,SAAS,EAAE,EACzB,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,GAC5C,eAAe,GAAG,SAAS,CAO7B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What namzu tells the model, in its own words, for a trigger the operator
|
|
3
|
+
* armed. Fixed text per trigger: operator text never enters it.
|
|
4
|
+
*
|
|
5
|
+
* It travels as a request-only `context` prompt contribution
|
|
6
|
+
* (`SendOptions.hostContext` in `../agent.ts`): after the history, never in
|
|
7
|
+
* it, and never in the system prompt, which is the cached prefix. The
|
|
8
|
+
* operator's message itself reaches the model and the session log unchanged.
|
|
9
|
+
*/
|
|
10
|
+
import { hypermodeEffort } from '../hypermode.js';
|
|
11
|
+
import { triggerDefinition } from './registry.js';
|
|
12
|
+
const TEXTS = {
|
|
13
|
+
hypermode: 'The operator asked for hypermode for THIS turn only: their message named it, and it is not on for the session. For this turn, treat delegation through `Agent` as the default for substantive work, not the exception: split the work into independent pieces — lookups, drafts, checks — and delegate them. Agents in the same phase are launched in the same response, each with `run_in_background: true` when you mean to wait for them together; a phase is never started one agent at a time. This changes only how you structure this turn; every tool call is reviewed exactly as usual.',
|
|
14
|
+
'save-skill': "The operator asked namzu to save this work as a skill after this turn. namzu runs /skills save itself once the turn ends, and that ends on the operator's own confirmation screen. Finish the task; do not call save_skill in this turn.",
|
|
15
|
+
schedule: 'The operator asked for this to run on a schedule. When the task is clear, propose a job with the `schedule` tool; the operator confirms it on screen. Do not create a `session_loop`; if a repeat inside this open session fits better, tell the operator to use /loop.',
|
|
16
|
+
};
|
|
17
|
+
/** The context texts for the armed triggers of one turn, in a fixed order. */
|
|
18
|
+
export function triggerContextTexts(ids) {
|
|
19
|
+
const texts = [];
|
|
20
|
+
for (const id of ids) {
|
|
21
|
+
const effect = triggerDefinition(id).effect;
|
|
22
|
+
if (effect.kind === 'turn-context' || effect.kind === 'after-turn') {
|
|
23
|
+
const text = TEXTS[effect.text];
|
|
24
|
+
if (!texts.includes(text))
|
|
25
|
+
texts.push(text);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return texts;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The effort the armed triggers pin for their turn, on a model that
|
|
32
|
+
* publishes `levels`: the highest level for max effort, else the level
|
|
33
|
+
* hypermode pins (`xhigh`, or the nearest below it). `undefined` when none
|
|
34
|
+
* pins one, or the model publishes no menu.
|
|
35
|
+
*/
|
|
36
|
+
export function triggerEffort(ids, levels) {
|
|
37
|
+
const kinds = ids.map((id) => triggerDefinition(id).effect);
|
|
38
|
+
if (kinds.some((effect) => effect.kind === 'turn-effort'))
|
|
39
|
+
return levels && levels.length > 0 ? levels[levels.length - 1] : undefined;
|
|
40
|
+
if (kinds.some((effect) => effect.kind === 'turn-context' && effect.effort === 'hypermode'))
|
|
41
|
+
return hypermodeEffort(levels);
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=context-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-text.js","sourceRoot":"","sources":["../../../src/tui/triggers/context-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,KAAK,GAA4C;IACtD,SAAS,EACR,kkBAAkkB;IACnkB,YAAY,EACX,0OAA0O;IAC3O,QAAQ,EACP,yQAAyQ;CAC1Q,CAAA;AAED,8EAA8E;AAC9E,MAAM,UAAU,mBAAmB,CAAC,GAAyB;IAC5D,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACtB,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAA;QAC3C,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACpE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC5C,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC5B,GAAyB,EACzB,MAA8C;IAE9C,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IAC3D,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa,CAAC;QACxD,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC3E,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;QAC1F,OAAO,eAAe,CAAC,MAAM,CAAC,CAAA;IAC/B,OAAO,SAAS,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the tag row says, at every width.
|
|
3
|
+
*
|
|
4
|
+
* Meaning is carried by words, never by colour or glyph alone: `✦` marks an
|
|
5
|
+
* armed trigger and `✧` anything else, but the state is also always a word
|
|
6
|
+
* or a mark — `?` for a suggestion, `(off)` for one dropped with Alt+W,
|
|
7
|
+
* `unavailable …` for one that cannot apply. Both glyphs are one cell wide
|
|
8
|
+
* and neither is an emoji. One row at every width; the text shortens by
|
|
9
|
+
* steps before it is cut.
|
|
10
|
+
*/
|
|
11
|
+
import type { Detection } from './detect.js';
|
|
12
|
+
import type { TriggerId } from './registry.js';
|
|
13
|
+
export declare const ARMED_MARK = "\u2726";
|
|
14
|
+
export declare const OTHER_MARK = "\u2727";
|
|
15
|
+
export interface TagCopyContext {
|
|
16
|
+
/** Columns the row may use. */
|
|
17
|
+
readonly columns: number;
|
|
18
|
+
/** A turn is running, so Enter steers into it. */
|
|
19
|
+
readonly turnActive: boolean;
|
|
20
|
+
/** The model's highest published effort level, when it publishes a menu (max effort). */
|
|
21
|
+
readonly highestEffort: string | undefined;
|
|
22
|
+
/** The level hypermode pins on this model (`xhigh`, or the nearest below it). */
|
|
23
|
+
readonly hypermodeEffort: string | undefined;
|
|
24
|
+
/** No paste chips and no attachments: a trigger-only message may run its command. */
|
|
25
|
+
readonly standaloneAllowed: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function tagRow(detection: Detection, context: TagCopyContext): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The line under the operator's row in the transcript, naming what the
|
|
30
|
+
* message carried: `hypermode (this turn, effort xhigh)`. The row's own
|
|
31
|
+
* glyph is the `✦`. Undefined when nothing applies.
|
|
32
|
+
*/
|
|
33
|
+
export declare function transcriptTagLine(ids: readonly TriggerId[], context: {
|
|
34
|
+
/** The effort the turn was pinned to, when a trigger pinned one. */
|
|
35
|
+
readonly effort: string | undefined;
|
|
36
|
+
readonly steered: boolean;
|
|
37
|
+
}): string | undefined;
|
|
38
|
+
//# sourceMappingURL=copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../src/tui/triggers/copy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,eAAO,MAAM,UAAU,WAAM,CAAA;AAC7B,eAAO,MAAM,UAAU,WAAM,CAAA;AAE7B,MAAM,WAAW,cAAc;IAC9B,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,kDAAkD;IAClD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,yFAAyF;IACzF,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1C,iFAAiF;IACjF,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5C,qFAAqF;IACrF,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAA;CACnC;AAKD,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAOnF;AAqHD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,SAAS,SAAS,EAAE,EACzB,OAAO,EAAE;IACR,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CACzB,GACC,MAAM,GAAG,SAAS,CAepB"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the tag row says, at every width.
|
|
3
|
+
*
|
|
4
|
+
* Meaning is carried by words, never by colour or glyph alone: `✦` marks an
|
|
5
|
+
* armed trigger and `✧` anything else, but the state is also always a word
|
|
6
|
+
* or a mark — `?` for a suggestion, `(off)` for one dropped with Alt+W,
|
|
7
|
+
* `unavailable …` for one that cannot apply. Both glyphs are one cell wide
|
|
8
|
+
* and neither is an emoji. One row at every width; the text shortens by
|
|
9
|
+
* steps before it is cut.
|
|
10
|
+
*/
|
|
11
|
+
export const ARMED_MARK = '✦';
|
|
12
|
+
export const OTHER_MARK = '✧';
|
|
13
|
+
/** Turn-scoped triggers apply only to a new turn: Enter mid-turn steers without them. */
|
|
14
|
+
const TURN_SCOPED = new Set(['hypermode', 'schedule', 'max-effort']);
|
|
15
|
+
export function tagRow(detection, context) {
|
|
16
|
+
if (detection.paused)
|
|
17
|
+
return fit(`${OTHER_MARK} triggers paused: draft too long`, context.columns);
|
|
18
|
+
const hits = detection.hits;
|
|
19
|
+
if (hits.length === 0)
|
|
20
|
+
return null;
|
|
21
|
+
const [only] = hits;
|
|
22
|
+
if (hits.length === 1 && only)
|
|
23
|
+
return fit(single(only, detection, context), context.columns);
|
|
24
|
+
return fit(several(hits, context), context.columns);
|
|
25
|
+
}
|
|
26
|
+
function single(hit, detection, context) {
|
|
27
|
+
const { columns } = context;
|
|
28
|
+
switch (hit.state) {
|
|
29
|
+
case 'suggested':
|
|
30
|
+
if (hit.id === 'schedule' && columns >= 80)
|
|
31
|
+
return `${OTHER_MARK} schedule? · alt+w: the agent proposes a job; you confirm it on screen`;
|
|
32
|
+
return columns >= 40
|
|
33
|
+
? `${OTHER_MARK} ${hit.label}? · alt+w arms`
|
|
34
|
+
: `${OTHER_MARK} ${hit.label}?`;
|
|
35
|
+
case 'dropped':
|
|
36
|
+
if (columns >= 60)
|
|
37
|
+
return `${OTHER_MARK} ${hit.label} (off) · alt+w restores`;
|
|
38
|
+
return `${OTHER_MARK} ${hit.label} (off)`;
|
|
39
|
+
case 'unavailable':
|
|
40
|
+
return `${OTHER_MARK} ${hit.label} · ${hit.reason ?? 'unavailable'}`;
|
|
41
|
+
case 'armed':
|
|
42
|
+
return armed(hit, detection, context);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function armed(hit, detection, context) {
|
|
46
|
+
const { columns, turnActive } = context;
|
|
47
|
+
const label = `${ARMED_MARK} ${hit.label}`;
|
|
48
|
+
if (columns < 40)
|
|
49
|
+
return label;
|
|
50
|
+
const pinned = hit.id === 'hypermode' ? context.hypermodeEffort : context.highestEffort;
|
|
51
|
+
const effort = pinned ? `effort ${pinned}` : undefined;
|
|
52
|
+
const detail = (() => {
|
|
53
|
+
if (turnActive && TURN_SCOPED.has(hit.id))
|
|
54
|
+
return {
|
|
55
|
+
full: 'enter steers without it · tab: new turn with it',
|
|
56
|
+
short: 'tab: new turn with it',
|
|
57
|
+
};
|
|
58
|
+
switch (hit.id) {
|
|
59
|
+
case 'hypermode':
|
|
60
|
+
if (detection.onlyTriggers)
|
|
61
|
+
return { full: 'type the task in the same message', short: 'add the task' };
|
|
62
|
+
return {
|
|
63
|
+
full: `this turn: ${effort ? `${effort}, ` : ''}delegate to parallel agents`,
|
|
64
|
+
short: `this turn${effort ? `, ${effort}` : ''}`,
|
|
65
|
+
...(effort ? { tiny: effort } : {}),
|
|
66
|
+
};
|
|
67
|
+
case 'save-skill':
|
|
68
|
+
if (detection.onlyTriggers && context.standaloneAllowed)
|
|
69
|
+
return turnActive
|
|
70
|
+
? { full: 'runs /skills save after the running turn', short: 'runs /skills save' }
|
|
71
|
+
: { full: 'runs /skills save', short: 'runs /skills save' };
|
|
72
|
+
if (turnActive)
|
|
73
|
+
return {
|
|
74
|
+
full: 'enter: after the running turn · tab: after the next',
|
|
75
|
+
short: 'after the running turn',
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
full: 'after this turn, if it did work; you confirm the file',
|
|
79
|
+
short: 'after this turn',
|
|
80
|
+
};
|
|
81
|
+
case 'schedule':
|
|
82
|
+
return {
|
|
83
|
+
full: 'the agent proposes a job; you confirm it on screen',
|
|
84
|
+
short: 'the agent proposes a job',
|
|
85
|
+
};
|
|
86
|
+
case 'max-effort':
|
|
87
|
+
return {
|
|
88
|
+
full: `this turn: ${effort ?? 'effort as is'}`,
|
|
89
|
+
short: `this turn${effort ? `, ${effort}` : ''}`,
|
|
90
|
+
...(effort ? { tiny: effort } : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
})();
|
|
94
|
+
if (columns >= 80)
|
|
95
|
+
return `${label} · ${detail.full} · alt+w drop`;
|
|
96
|
+
if (columns >= 60)
|
|
97
|
+
return `${label} · ${detail.short} · alt+w`;
|
|
98
|
+
return detail.tiny ? `${label} · ${detail.tiny} · alt+w` : `${label} · alt+w`;
|
|
99
|
+
}
|
|
100
|
+
function several(hits, context) {
|
|
101
|
+
const { columns, hypermodeEffort } = context;
|
|
102
|
+
const armedCount = hits.filter((hit) => hit.state === 'armed').length;
|
|
103
|
+
const offCount = hits.filter((hit) => hit.state === 'dropped').length;
|
|
104
|
+
const key = armedCount > 0 ? 'alt+w drop' : offCount > 0 ? 'alt+w restores' : 'alt+w arms';
|
|
105
|
+
if (columns < 60) {
|
|
106
|
+
const counts = [
|
|
107
|
+
armedCount > 0 ? `${armedCount} armed` : undefined,
|
|
108
|
+
offCount > 0 ? `${offCount} off` : undefined,
|
|
109
|
+
hits.length - armedCount - offCount > 0
|
|
110
|
+
? `${hits.length - armedCount - offCount} more?`
|
|
111
|
+
: undefined,
|
|
112
|
+
]
|
|
113
|
+
.filter(Boolean)
|
|
114
|
+
.join(' · ');
|
|
115
|
+
const mark = armedCount > 0 ? ARMED_MARK : OTHER_MARK;
|
|
116
|
+
return columns >= 40 ? `${mark} ${counts} · alt+w` : `${mark} ${counts}`;
|
|
117
|
+
}
|
|
118
|
+
const parts = hits.map((hit) => {
|
|
119
|
+
switch (hit.state) {
|
|
120
|
+
case 'armed':
|
|
121
|
+
// The effort pin is said wherever hypermode is armed.
|
|
122
|
+
return hit.id === 'hypermode' && hypermodeEffort
|
|
123
|
+
? `${ARMED_MARK} hypermode (effort ${hypermodeEffort})`
|
|
124
|
+
: `${ARMED_MARK} ${hit.label}`;
|
|
125
|
+
case 'suggested':
|
|
126
|
+
return `${OTHER_MARK} ${hit.label}?`;
|
|
127
|
+
case 'dropped':
|
|
128
|
+
return `${OTHER_MARK} ${hit.label} (off)`;
|
|
129
|
+
case 'unavailable':
|
|
130
|
+
return `${OTHER_MARK} ${hit.label} (unavailable)`;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return `${parts.join(' · ')} · ${columns >= 80 ? key : 'alt+w'}`;
|
|
134
|
+
}
|
|
135
|
+
/** Cut to `columns` with an ellipsis; the row is always one line. */
|
|
136
|
+
function fit(text, columns) {
|
|
137
|
+
const cells = [...text];
|
|
138
|
+
if (cells.length <= columns)
|
|
139
|
+
return text;
|
|
140
|
+
return `${cells.slice(0, Math.max(0, columns - 1)).join('')}…`;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The line under the operator's row in the transcript, naming what the
|
|
144
|
+
* message carried: `hypermode (this turn, effort xhigh)`. The row's own
|
|
145
|
+
* glyph is the `✦`. Undefined when nothing applies.
|
|
146
|
+
*/
|
|
147
|
+
export function transcriptTagLine(ids, context) {
|
|
148
|
+
const effort = context.effort ? `, effort ${context.effort}` : '';
|
|
149
|
+
const parts = ids.flatMap((id) => {
|
|
150
|
+
switch (id) {
|
|
151
|
+
case 'hypermode':
|
|
152
|
+
return context.steered ? [] : [`hypermode (this turn${effort})`];
|
|
153
|
+
case 'save-skill':
|
|
154
|
+
return [`save as skill (${context.steered ? 'after the running turn' : 'after this turn'})`];
|
|
155
|
+
case 'schedule':
|
|
156
|
+
return context.steered ? [] : ['schedule (the agent proposes a job)'];
|
|
157
|
+
case 'max-effort':
|
|
158
|
+
return context.steered ? [] : [`max effort (this turn${effort})`];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
return parts.length > 0 ? parts.join(' · ') : undefined;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=copy.js.map
|