maka-agent 0.2.0-dev.23.20260906 → 0.2.0-dev.25.20260908
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/README.md +38 -19
- package/README.zh-CN.md +34 -19
- package/dist/acp/maka-acp-agent.js +2 -1
- package/dist/acp/session-configuration.js +143 -0
- package/dist/acp/session-registry.js +90 -4
- package/dist/cli-core.js +2 -0
- package/dist/pi-transcript-tools.js +6 -0
- package/dist/pi-transcript.js +5 -12
- package/dist/pi-tui-layout.js +56 -10
- package/dist/pi-tui-pickers.js +102 -1
- package/dist/pi-tui-runner.js +230 -46
- package/dist/pi-tui-todo.js +221 -0
- package/dist/pi-tui-transcript-viewer.js +134 -7
- package/dist/runtime-host-cli-context.js +224 -78
- package/dist/runtime-host-cli-installation.js +8 -2
- package/dist/runtime-host-cli.js +31 -1
- package/dist/runtime-host-handoff-surface.js +106 -0
- package/dist/runtime-host-installed-update-bootstrap.js +13 -0
- package/dist/runtime-host-installed-update-coordinator.js +33 -0
- package/dist/runtime-host-lifecycle-transaction.js +9 -1
- package/dist/runtime-host-local-handoff.js +48 -5
- package/dist/runtime-host-local-managed-activation.js +84 -0
- package/dist/runtime-host-local-source-retirement.js +18 -2
- package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
- package/dist/runtime-host-operator-retirement.js +50 -0
- package/dist/runtime-host-service-manager.js +3 -3
- package/dist/runtime-host-session-channel.js +13 -0
- package/dist/runtime-host-session-driver.js +46 -26
- package/dist/runtime-host-session-update.js +62 -0
- package/dist/runtime-host-tui-command.js +38 -73
- package/dist/runtime-host-tui-context.js +1 -0
- package/dist/runtime-host-tui-owner.js +226 -0
- package/dist/tui-copy-catalog.js +219 -6
- package/dist/tui-host-owner-copy.js +24 -0
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/agent-run.js +1 -0
- package/node_modules/@maka/core/dist/attachments.js +3 -0
- package/node_modules/@maka/core/dist/canonical-json.js +27 -0
- package/node_modules/@maka/core/dist/canonical-runtime-event.js +3 -1
- package/node_modules/@maka/core/dist/capabilities.js +35 -0
- package/node_modules/@maka/core/dist/computer-use.js +0 -1
- package/node_modules/@maka/core/dist/display-redaction.js +18 -0
- package/node_modules/@maka/core/dist/llm-connections.js +13 -0
- package/node_modules/@maka/core/dist/model-call-attempt.js +2 -0
- package/node_modules/@maka/core/dist/model-failure.js +40 -0
- package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -4
- package/node_modules/@maka/core/dist/model-metadata.js +7 -3
- package/node_modules/@maka/core/dist/model-web-search.js +5 -4
- package/node_modules/@maka/core/dist/provider-registry.js +45 -4
- package/node_modules/@maka/core/dist/record-schema.js +9 -2
- package/node_modules/@maka/core/dist/redaction.js +35 -0
- package/node_modules/@maka/core/dist/run-composition.js +77 -2
- package/node_modules/@maka/core/dist/runtime-boundary.js +31 -11
- package/node_modules/@maka/core/dist/runtime-event.js +37 -6
- package/node_modules/@maka/core/dist/runtime-handoff.js +98 -0
- package/node_modules/@maka/core/dist/runtime-invocation.js +1 -1
- package/node_modules/@maka/core/dist/runtime-logical-execution.js +112 -0
- package/node_modules/@maka/core/dist/session.js +84 -56
- package/node_modules/@maka/core/dist/slash-command-catalog.js +3 -0
- package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +20 -0
- package/node_modules/@maka/core/dist/tool-result-record-schema.js +2 -1
- package/node_modules/@maka/core/dist/usage-record-schema.js +26 -35
- package/node_modules/@maka/core/package.json +5 -0
- package/node_modules/@maka/eval/dist/experiment-directory.js +4 -13
- package/node_modules/@maka/mcp/dist/index.js +131 -1
- package/node_modules/@maka/runtime/dist/agent-run-inspect.js +0 -13
- package/node_modules/@maka/runtime/dist/agent-run.js +351 -105
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +29 -13
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +109 -34
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +184 -183
- package/node_modules/@maka/runtime/dist/archive-read-tool.js +2 -2
- package/node_modules/@maka/runtime/dist/context-budget-helpers.js +0 -16
- package/node_modules/@maka/runtime/dist/context-budget.js +14 -9
- package/node_modules/@maka/runtime/dist/conversation-copy.js +158 -15
- package/node_modules/@maka/runtime/dist/github-copilot-oauth-enrollment.js +3 -3
- package/node_modules/@maka/runtime/dist/goal-continuation.js +36 -4
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +18 -9
- package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +30 -22
- package/node_modules/@maka/runtime/dist/history-compaction.js +29 -4
- package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +174 -0
- package/node_modules/@maka/runtime/dist/mcp-tools.js +7 -2
- package/node_modules/@maka/runtime/dist/message-authority.js +9 -0
- package/node_modules/@maka/runtime/dist/model-adapter.js +19 -98
- package/node_modules/@maka/runtime/dist/model-factory.js +19 -81
- package/node_modules/@maka/runtime/dist/model-fetcher.js +49 -2
- package/node_modules/@maka/runtime/dist/model-history.js +0 -112
- package/node_modules/@maka/runtime/dist/model-runtime.js +85 -111
- package/node_modules/@maka/runtime/dist/native-web-search-tool.js +2 -1
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +2 -2
- package/node_modules/@maka/runtime/dist/opencode-session-header.js +4 -2
- package/node_modules/@maka/runtime/dist/plugin-runtime.js +20 -10
- package/node_modules/@maka/runtime/dist/plugin-tool-service.js +205 -0
- package/node_modules/@maka/runtime/dist/provider-error-classification.js +84 -123
- package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +76 -109
- package/node_modules/@maka/runtime/dist/request-shape.js +23 -0
- package/node_modules/@maka/runtime/dist/run-handoff-gate.js +97 -0
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +83 -55
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +121 -159
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +157 -112
- package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +160 -79
- package/node_modules/@maka/runtime/dist/runtime-read-model.js +30 -89
- package/node_modules/@maka/runtime/dist/runtime-resume.js +80 -4
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +5 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +171 -288
- package/node_modules/@maka/runtime/dist/session-projection-helpers.js +0 -27
- package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +21 -0
- package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +0 -5
- package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +3 -4
- package/node_modules/@maka/runtime/dist/test-connection.js +16 -17
- package/node_modules/@maka/runtime/dist/tool-activation-identity.js +41 -0
- package/node_modules/@maka/runtime/dist/tool-availability.js +11 -1
- package/node_modules/@maka/runtime/dist/tool-result-archive-encoding.js +38 -0
- package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +63 -1
- package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +42 -12
- package/node_modules/@maka/runtime/dist/tool-result-archive.js +27 -4
- package/node_modules/@maka/runtime/dist/tool-runtime.js +3 -61
- package/node_modules/@maka/runtime/package.json +2 -0
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +35 -0
- package/node_modules/@maka/runtime-host/dist/client/connect-or-spawn.js +9 -1
- package/node_modules/@maka/runtime-host/dist/client/connection.js +3 -0
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +179 -0
- package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +275 -0
- package/node_modules/@maka/runtime-host/dist/client/host-retirement.js +26 -5
- package/node_modules/@maka/runtime-host/dist/client/index.js +2 -0
- package/node_modules/@maka/runtime-host/dist/client/launcher.js +3 -0
- package/node_modules/@maka/runtime-host/dist/client/remote-compatibility-error.js +2 -0
- package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +46 -5
- package/node_modules/@maka/runtime-host/dist/control/endpoint.js +1 -3
- package/node_modules/@maka/runtime-host/dist/node-error.js +22 -0
- package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
- package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +1 -3
- package/node_modules/@maka/runtime-host/dist/operator/retirement-cancellation.js +20 -0
- package/node_modules/@maka/runtime-host/dist/peer-mesh/limits.js +0 -1
- package/node_modules/@maka/runtime-host/dist/peer-mesh/model.js +1 -1
- package/node_modules/@maka/runtime-host/dist/peer-reachability/publisher.js +1 -3
- package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +21 -12
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +29 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/plan.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +27 -5
- package/node_modules/@maka/runtime-host/dist/protocol/project-catalog.js +2 -2
- package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +40 -20
- package/node_modules/@maka/runtime-host/dist/protocol/session-transcript.js +0 -5
- package/node_modules/@maka/runtime-host/dist/protocol/session-turns.js +29 -58
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +11 -1
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +31 -2
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/agent-graph-coordinator.js +0 -3
- package/node_modules/@maka/runtime-host/dist/server/canonical-turn-snapshot.js +19 -4
- package/node_modules/@maka/runtime-host/dist/server/connection-session.js +7 -6
- package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +32 -32
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +144 -33
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +5 -5
- package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +45 -16
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +40 -1
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +96 -17
- package/node_modules/@maka/runtime-host/dist/server/host-residency-registry.js +13 -7
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-admission-registry.js +3 -1
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +124 -62
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +47 -22
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +76 -6
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +325 -73
- package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +37 -2
- package/node_modules/@maka/runtime-host/dist/server/serial-outbound-writer.js +45 -3
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +50 -7
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +87 -25
- package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +5 -2
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +12 -55
- package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +1 -16
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +0 -1
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +460 -70
- package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/storage-maintenance.js +109 -0
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +20 -2
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +13 -4
- package/node_modules/@maka/runtime-host/dist/server/workhub-message-attachments.js +46 -0
- package/node_modules/@maka/storage/dist/artifact-store.js +21 -10
- package/node_modules/@maka/storage/dist/artifact-stores.js +1 -1
- package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +0 -5
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +284 -198
- package/node_modules/@maka/storage/dist/context-offload-snapshot.js +325 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +9 -7
- package/node_modules/@maka/storage/dist/file-session-repository.js +1012 -0
- package/node_modules/@maka/storage/dist/git-exec.js +61 -0
- package/node_modules/@maka/storage/dist/git-worktree-child-executor.js +8 -35
- package/node_modules/@maka/storage/dist/goal-authority.js +2 -2
- package/node_modules/@maka/storage/dist/interaction-store.js +2 -2
- package/node_modules/@maka/storage/dist/opencode-session-adapter.js +0 -4
- package/node_modules/@maka/storage/dist/operational-state-backup.js +9 -5
- package/node_modules/@maka/storage/dist/project-catalog.js +2 -23
- package/node_modules/@maka/storage/dist/runtime-event-invariants.js +2 -2
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +8 -3
- package/node_modules/@maka/storage/dist/runtime-transcript-query.js +308 -0
- package/node_modules/@maka/storage/dist/scheduled-task-store.js +249 -283
- package/node_modules/@maka/storage/dist/session-bundle-manifest.js +5 -17
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +26 -5
- package/node_modules/@maka/storage/dist/session-copy-cleanup.js +2 -1
- package/node_modules/@maka/storage/dist/session-message-projection.js +15 -0
- package/node_modules/@maka/storage/dist/session-repository.js +767 -0
- package/node_modules/@maka/storage/dist/session-store.js +25 -99
- package/node_modules/@maka/storage/dist/sqlite-artifact-metadata.js +10 -3
- package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +24 -8
- package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +7 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +44 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +130 -27
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +109 -892
- package/node_modules/@maka/storage/dist/storage-id.js +28 -0
- package/node_modules/@maka/storage/dist/tool-result-archive-evidence.js +138 -0
- package/node_modules/@maka/storage/dist/workspace-identity.js +2 -15
- package/node_modules/@maka/storage/dist/workspace-version-authority-internal.js +1 -8
- package/node_modules/@maka/storage/package.json +2 -0
- package/package.json +1 -1
package/dist/pi-tui-layout.js
CHANGED
|
@@ -48,8 +48,8 @@ export class MakaTranscriptComponent {
|
|
|
48
48
|
* by the live terminal-scrollback reconciliation path.
|
|
49
49
|
*/
|
|
50
50
|
createDocumentRenderer() {
|
|
51
|
-
// The detached keys and their rendered-line cache
|
|
52
|
-
//
|
|
51
|
+
// The detached keys and their rendered-line cache belong to one Session's
|
|
52
|
+
// reader. Reopening keeps its position; switching Sessions releases it.
|
|
53
53
|
const entryClones = new WeakMap();
|
|
54
54
|
const documentEntry = (entry) => {
|
|
55
55
|
const cached = entryClones.get(entry);
|
|
@@ -61,11 +61,35 @@ export class MakaTranscriptComponent {
|
|
|
61
61
|
entryClones.set(entry, clone);
|
|
62
62
|
return clone;
|
|
63
63
|
};
|
|
64
|
-
return (width) =>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
return (width, expanded) => {
|
|
65
|
+
const entries = this.state.entries.map(documentEntry);
|
|
66
|
+
if (expanded !== undefined) {
|
|
67
|
+
for (const entry of entries) {
|
|
68
|
+
if (entry.kind === 'tool' || entry.kind === 'thinking')
|
|
69
|
+
entry.expanded = expanded;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const detachedState = {
|
|
73
|
+
...this.state,
|
|
74
|
+
entries,
|
|
75
|
+
renderGeometry: { entryFirstLine: undefined, viewportTop: 0 },
|
|
76
|
+
};
|
|
77
|
+
const lines = renderMakaPiTranscript(detachedState, this.metadata(), width);
|
|
78
|
+
const anchors = entries.flatMap((entry, index) => {
|
|
79
|
+
if (entry.kind === 'tool' && entry.suppressed)
|
|
80
|
+
return [];
|
|
81
|
+
const line = detachedState.renderGeometry.entryFirstLine?.get(entry);
|
|
82
|
+
if (line === undefined)
|
|
83
|
+
return [];
|
|
84
|
+
const id = entry.kind === 'tool'
|
|
85
|
+
? `tool:${entry.turnId ?? ''}:${entry.toolUseId}`
|
|
86
|
+
: 'messageId' in entry
|
|
87
|
+
? `${entry.kind}:${entry.messageId}`
|
|
88
|
+
: `${entry.kind}:${index}`;
|
|
89
|
+
return [{ id, line }];
|
|
90
|
+
});
|
|
91
|
+
return { lines, anchors };
|
|
92
|
+
};
|
|
69
93
|
}
|
|
70
94
|
}
|
|
71
95
|
export class MakaStatusLineComponent {
|
|
@@ -121,11 +145,12 @@ export class MakaPiLayoutComponent extends Container {
|
|
|
121
145
|
editor;
|
|
122
146
|
statusLine;
|
|
123
147
|
terminal;
|
|
148
|
+
todoIndicator;
|
|
124
149
|
/** Composed lines of the previous render, for the viewport-top shadow diff. */
|
|
125
150
|
previousLines;
|
|
126
151
|
previousRows;
|
|
127
152
|
previousWidth;
|
|
128
|
-
constructor(state, transcript, activityStrip, pendingQueue, editor, statusLine, terminal) {
|
|
153
|
+
constructor(state, transcript, activityStrip, pendingQueue, editor, statusLine, terminal, todoIndicator) {
|
|
129
154
|
super();
|
|
130
155
|
this.state = state;
|
|
131
156
|
this.transcript = transcript;
|
|
@@ -134,9 +159,12 @@ export class MakaPiLayoutComponent extends Container {
|
|
|
134
159
|
this.editor = editor;
|
|
135
160
|
this.statusLine = statusLine;
|
|
136
161
|
this.terminal = terminal;
|
|
162
|
+
this.todoIndicator = todoIndicator;
|
|
137
163
|
this.addChild(transcript);
|
|
138
164
|
this.addChild(activityStrip);
|
|
139
165
|
this.addChild(pendingQueue);
|
|
166
|
+
if (todoIndicator)
|
|
167
|
+
this.addChild(todoIndicator);
|
|
140
168
|
this.addChild(editor);
|
|
141
169
|
this.addChild(statusLine);
|
|
142
170
|
}
|
|
@@ -145,14 +173,27 @@ export class MakaPiLayoutComponent extends Container {
|
|
|
145
173
|
const activityLines = this.activityStrip.render(width);
|
|
146
174
|
const allPendingLines = this.pendingQueue.render(width);
|
|
147
175
|
const statusLines = this.statusLine.render(width);
|
|
176
|
+
// Supplementary information must not steal the composer's minimum space.
|
|
177
|
+
const todoLines = this.terminal.rows >
|
|
178
|
+
activityLines.length +
|
|
179
|
+
allPendingLines.length +
|
|
180
|
+
statusLines.length +
|
|
181
|
+
this.editor.minimumViewportRows()
|
|
182
|
+
? (this.todoIndicator?.render(width) ?? []).slice(0, 1)
|
|
183
|
+
: [];
|
|
148
184
|
const pendingRowsAvailable = this.editor.isShowingAutocomplete()
|
|
149
185
|
? Math.max(0, this.terminal.rows -
|
|
150
186
|
activityLines.length -
|
|
151
187
|
statusLines.length -
|
|
188
|
+
todoLines.length -
|
|
152
189
|
this.editor.minimumViewportRows())
|
|
153
190
|
: allPendingLines.length;
|
|
154
191
|
const pendingLines = fitPendingQueueLines(allPendingLines, pendingRowsAvailable);
|
|
155
|
-
this.editor.setViewportRows(this.terminal.rows -
|
|
192
|
+
this.editor.setViewportRows(this.terminal.rows -
|
|
193
|
+
activityLines.length -
|
|
194
|
+
pendingLines.length -
|
|
195
|
+
statusLines.length -
|
|
196
|
+
todoLines.length);
|
|
156
197
|
const editorLines = this.editor.render(width);
|
|
157
198
|
// #1064: when the activity strip is showing (a turn is running), separate
|
|
158
199
|
// it from the last transcript line with a blank row. Without this, a
|
|
@@ -162,7 +203,11 @@ export class MakaPiLayoutComponent extends Container {
|
|
|
162
203
|
const lastTranscriptLine = transcriptLines[transcriptLines.length - 1];
|
|
163
204
|
const needGap = activityActive && lastTranscriptLine !== undefined && lastTranscriptLine.length > 0;
|
|
164
205
|
const paddedTranscript = needGap ? [...transcriptLines, ''] : transcriptLines;
|
|
165
|
-
const chromeRows = activityLines.length +
|
|
206
|
+
const chromeRows = activityLines.length +
|
|
207
|
+
pendingLines.length +
|
|
208
|
+
todoLines.length +
|
|
209
|
+
editorLines.length +
|
|
210
|
+
statusLines.length;
|
|
166
211
|
const viewportRows = Math.max(0, this.terminal.rows - chromeRows);
|
|
167
212
|
const paddingRows = Math.max(0, viewportRows - paddedTranscript.length);
|
|
168
213
|
const lines = [
|
|
@@ -170,6 +215,7 @@ export class MakaPiLayoutComponent extends Container {
|
|
|
170
215
|
...Array.from({ length: paddingRows }, () => ''),
|
|
171
216
|
...activityLines,
|
|
172
217
|
...pendingLines,
|
|
218
|
+
...todoLines,
|
|
173
219
|
...editorLines,
|
|
174
220
|
...statusLines,
|
|
175
221
|
];
|
package/dist/pi-tui-pickers.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { CombinedAutocompleteProvider, Editor, Key, SelectList, decodeKittyPrintable, isKeyRepeat, matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from '@earendil-works/pi-tui';
|
|
19
|
+
import { CombinedAutocompleteProvider, Editor, Key, SelectList, decodeKittyPrintable, isKeyRelease, isKeyRepeat, matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from '@earendil-works/pi-tui';
|
|
20
20
|
import { defineUiMessageCatalog, formatUiMessage, resolveUiMessageCatalog, } from '@maka/core/ui-locale';
|
|
21
21
|
import { providerDefaultsOf, validateSlug, } from '@maka/core/llm-connections';
|
|
22
22
|
import { CONNECTION_NAME_MAX_LENGTH } from '@maka/core/runtime-policy';
|
|
@@ -552,6 +552,107 @@ function matchesModelChoice(choice, query) {
|
|
|
552
552
|
return true;
|
|
553
553
|
return false;
|
|
554
554
|
}
|
|
555
|
+
export class SessionSearchOverlay {
|
|
556
|
+
tui;
|
|
557
|
+
input;
|
|
558
|
+
renderWidth = 0;
|
|
559
|
+
searchEditor;
|
|
560
|
+
copy;
|
|
561
|
+
choices;
|
|
562
|
+
filtered;
|
|
563
|
+
list;
|
|
564
|
+
selectedValue;
|
|
565
|
+
scopeLabel;
|
|
566
|
+
constructor(tui, input) {
|
|
567
|
+
this.tui = tui;
|
|
568
|
+
this.input = input;
|
|
569
|
+
this.copy = getTuiPickerCopy(input.locale);
|
|
570
|
+
this.choices = input.choices;
|
|
571
|
+
this.filtered = input.choices;
|
|
572
|
+
this.scopeLabel = input.scopeLabel;
|
|
573
|
+
this.list = this.buildList();
|
|
574
|
+
this.searchEditor = new Editor(tui, editorTheme(), { paddingX: 0 });
|
|
575
|
+
this.searchEditor.onChange = (text) => this.applyQuery(text);
|
|
576
|
+
}
|
|
577
|
+
updateChoices(choices, scopeLabel) {
|
|
578
|
+
this.choices = choices;
|
|
579
|
+
this.scopeLabel = scopeLabel;
|
|
580
|
+
this.applyQuery(this.searchEditor.getText());
|
|
581
|
+
}
|
|
582
|
+
buildList() {
|
|
583
|
+
const list = new SelectList(this.filtered.map(({ item }) => item), 10, selectListTheme(), {
|
|
584
|
+
minPrimaryColumnWidth: 20,
|
|
585
|
+
maxPrimaryColumnWidth: Math.max(20, this.renderWidth - 30),
|
|
586
|
+
});
|
|
587
|
+
const selectedIndex = this.filtered.findIndex(({ item }) => item.value === this.selectedValue);
|
|
588
|
+
if (selectedIndex >= 0)
|
|
589
|
+
list.setSelectedIndex(selectedIndex);
|
|
590
|
+
list.onSelectionChange = (item) => {
|
|
591
|
+
this.selectedValue = item.value;
|
|
592
|
+
};
|
|
593
|
+
list.onSelect = (item) => {
|
|
594
|
+
this.selectedValue = item.value;
|
|
595
|
+
this.input.onSelect(item);
|
|
596
|
+
};
|
|
597
|
+
list.onCancel = () => this.input.onCancel();
|
|
598
|
+
return list;
|
|
599
|
+
}
|
|
600
|
+
applyQuery(text) {
|
|
601
|
+
const query = text.trim().toLocaleLowerCase();
|
|
602
|
+
this.filtered = query
|
|
603
|
+
? this.choices.filter((choice) => choice.searchText.includes(query))
|
|
604
|
+
: this.choices;
|
|
605
|
+
this.list = this.buildList();
|
|
606
|
+
}
|
|
607
|
+
invalidate() {
|
|
608
|
+
this.searchEditor.invalidate();
|
|
609
|
+
this.list.invalidate();
|
|
610
|
+
}
|
|
611
|
+
handleInput(data) {
|
|
612
|
+
if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl('c'))) {
|
|
613
|
+
this.input.onCancel();
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
if (matchesKey(data, Key.tab) && !isKeyRelease(data) && !isKeyRepeat(data)) {
|
|
617
|
+
this.input.onToggleScope();
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
if (matchesKey(data, Key.up) || matchesKey(data, Key.down) || matchesKey(data, Key.enter)) {
|
|
621
|
+
if (matchesKey(data, Key.enter) && isKeyRepeat(data))
|
|
622
|
+
return;
|
|
623
|
+
this.list.handleInput(data);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
this.searchEditor.handleInput(data);
|
|
627
|
+
}
|
|
628
|
+
render(width) {
|
|
629
|
+
const safeWidth = Math.max(1, width);
|
|
630
|
+
if (safeWidth !== this.renderWidth) {
|
|
631
|
+
this.renderWidth = safeWidth;
|
|
632
|
+
this.list = this.buildList();
|
|
633
|
+
}
|
|
634
|
+
this.searchEditor.focused = true;
|
|
635
|
+
return [
|
|
636
|
+
padLine(`${this.copy.resumeSessionTitle} ${ansi.accent(this.scopeLabel)}`, safeWidth),
|
|
637
|
+
padLine(ansi.dim(this.copy.sessionSearchHint), safeWidth),
|
|
638
|
+
padLine('', safeWidth),
|
|
639
|
+
...this.renderFieldRow(safeWidth),
|
|
640
|
+
padLine('', safeWidth),
|
|
641
|
+
...(this.filtered.length === 0
|
|
642
|
+
? [padLine(ansi.dim(this.copy.noMatchingSessions), safeWidth)]
|
|
643
|
+
: this.list.render(safeWidth).map((line) => formatPickerItemLine(line, safeWidth))),
|
|
644
|
+
padLine(ansi.accent('-'.repeat(safeWidth)), safeWidth),
|
|
645
|
+
];
|
|
646
|
+
}
|
|
647
|
+
renderFieldRow(width) {
|
|
648
|
+
const prefix = `${this.copy.searchLabel} `;
|
|
649
|
+
const contentWidth = Math.max(1, width - visibleWidth(prefix));
|
|
650
|
+
const editorLines = this.searchEditor.render(contentWidth).slice(1, -1);
|
|
651
|
+
return editorLines.length > 0
|
|
652
|
+
? editorLines.map((line, index) => padLine(`${index === 0 ? prefix : ' '.repeat(prefix.length)}${line}`, width))
|
|
653
|
+
: [padLine(prefix, width)];
|
|
654
|
+
}
|
|
655
|
+
}
|
|
555
656
|
export function getTuiPickerCopy(locale) {
|
|
556
657
|
return TUI_PICKER_COPY[locale];
|
|
557
658
|
}
|