maka-agent 0.2.0-dev.11.20260831 → 0.2.0-dev.12.20260901
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 +2 -2
- package/RUNTIME_HOST_PEER_DEPENDENCIES.rust.tsv +70 -0
- package/RUNTIME_HOST_PEER_THIRD_PARTY_NOTICES.txt +1839 -140
- package/dist/cli-core.js +25 -1
- package/dist/mcp-capability-provider.js +1 -1
- package/dist/onboarding-catalog.js +3 -5
- package/dist/pi-transcript.js +21 -17
- package/dist/pi-tui-layout.js +4 -2
- package/dist/pi-tui-mcp-status.js +44 -130
- package/dist/pi-tui-pickers.js +11 -5
- package/dist/pi-tui-runner.js +133 -102
- package/dist/runtime-host-cli.js +150 -4
- package/dist/runtime-host-lifecycle-transaction.js +5 -2
- package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
- package/dist/runtime-host-onboarding.js +12 -16
- package/dist/runtime-host-peer-management-command.js +16 -4
- package/dist/runtime-host-plugin-command.js +101 -0
- package/dist/runtime-host-run-command.js +5 -1
- package/dist/runtime-host-service-management-command.js +2 -1
- package/dist/runtime-host-setup-command.js +1 -0
- package/dist/runtime-host-task-readiness.js +2 -3
- package/dist/runtime-host-tui-command.js +1 -1
- package/dist/runtime-host-tui-context.js +18 -5
- package/dist/runtime-host-update-command.js +13 -5
- package/dist/runtime-host-update-discovery.js +1 -0
- package/dist/tui-clipboard.js +86 -0
- package/dist/tui-copy-catalog.js +246 -0
- package/dist/tui-copy-command.js +103 -0
- package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
- package/node_modules/@maka/core/dist/attachments.js +80 -1
- package/node_modules/@maka/core/dist/bounded-response.js +71 -0
- package/node_modules/@maka/core/dist/chat-model-choice.js +8 -33
- package/node_modules/@maka/core/dist/client-capability-grant.js +149 -0
- package/node_modules/@maka/core/dist/connection-readiness.js +3 -31
- package/node_modules/@maka/core/dist/deep-research.js +1 -20
- package/node_modules/@maka/core/dist/events.js +22 -1
- package/node_modules/@maka/core/dist/foreign-session.js +2 -2
- package/node_modules/@maka/core/dist/interaction.js +49 -2
- package/node_modules/@maka/core/dist/llm-connections.js +74 -82
- package/node_modules/@maka/core/dist/model-catalog.js +221 -315
- package/node_modules/@maka/core/dist/model-facts.js +13 -19
- package/node_modules/@maka/core/dist/model-metadata.generated.js +1907 -1872
- package/node_modules/@maka/core/dist/model-metadata.js +184 -199
- package/node_modules/@maka/core/dist/model-thinking.js +1 -1
- package/node_modules/@maka/core/dist/models-dev-projection.js +302 -0
- package/node_modules/@maka/core/dist/models-dev-refresh.js +55 -0
- package/node_modules/@maka/core/dist/onboarding.js +2 -1
- package/node_modules/@maka/core/dist/provider-auth.js +47 -291
- package/node_modules/@maka/core/dist/provider-registry.js +68 -357
- package/node_modules/@maka/core/dist/runtime-event.js +4 -0
- package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +34 -18
- package/node_modules/@maka/core/dist/runtime-policy/model-catalog-entry-codec.js +75 -0
- package/node_modules/@maka/core/dist/runtime-policy.js +2 -1
- package/node_modules/@maka/core/dist/session-send-projection.js +2 -1
- package/node_modules/@maka/core/dist/session-start-mode.js +42 -0
- package/node_modules/@maka/core/dist/session.js +119 -5
- package/node_modules/@maka/core/dist/slash-command-catalog.js +1 -0
- package/node_modules/@maka/core/dist/task-submission-readiness.js +2 -1
- package/node_modules/@maka/core/dist/workhub-creation-intent.js +896 -0
- package/node_modules/@maka/core/package.json +6 -1
- package/node_modules/@maka/runtime/dist/agent-run.js +7 -0
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +3 -2
- package/node_modules/@maka/runtime/dist/image-file.js +5 -20
- package/node_modules/@maka/runtime/dist/local-web-fetch.js +2 -43
- package/node_modules/@maka/runtime/dist/mcp-tools.js +28 -0
- package/node_modules/@maka/runtime/dist/model-fetcher.js +15 -8
- package/node_modules/@maka/runtime/dist/model-history.js +18 -1
- package/node_modules/@maka/runtime/dist/model-runtime.js +2 -2
- package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +173 -20
- package/node_modules/@maka/runtime/dist/plugin-runtime.js +219 -0
- package/node_modules/@maka/runtime/dist/quiescent-session-snapshot.js +78 -0
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +3 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +1 -0
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +8 -4
- package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +93 -83
- package/node_modules/@maka/runtime/dist/test-connection.js +6 -6
- package/node_modules/@maka/runtime/dist/tool-runtime.js +50 -6
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +39 -16
- package/node_modules/@maka/runtime/package.json +1 -0
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +10 -0
- package/node_modules/@maka/runtime-host/dist/client/catalog-reader.js +19 -5
- package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +3 -2
- package/node_modules/@maka/runtime-host/dist/client/connection.js +22 -0
- package/node_modules/@maka/runtime-host/dist/client/host-profile.js +1 -0
- package/node_modules/@maka/runtime-host/dist/client/index.js +1 -0
- package/node_modules/@maka/runtime-host/dist/client/oauth-presentation.js +1 -1
- package/node_modules/@maka/runtime-host/dist/client/peer-client.js +4 -0
- package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +8 -0
- package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
- package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +2 -0
- package/node_modules/@maka/runtime-host/dist/operator/peer-management-frame.js +2 -0
- package/node_modules/@maka/runtime-host/dist/operator/service-management-frame.js +2 -0
- package/node_modules/@maka/runtime-host/dist/peer-mesh/owner.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +22 -1
- package/node_modules/@maka/{storage/dist/task-ledger-store-internal.js → runtime-host/dist/protocol/connection-catalog-change.js} +7 -13
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +33 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +3 -1
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +512 -0
- package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +25 -61
- package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +1 -1
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +4 -1
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +92 -4
- package/node_modules/@maka/runtime-host/dist/server/access-authority.js +15 -13
- package/node_modules/@maka/runtime-host/dist/server/access-credential-metadata.js +4 -2
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +119 -47
- package/node_modules/@maka/runtime-host/dist/server/bootstrap-runtime-policy.js +10 -4
- package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +192 -18
- package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +122 -48
- package/node_modules/@maka/runtime-host/dist/server/client-capability-provider-id.js +31 -0
- package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +5 -5
- package/node_modules/@maka/runtime-host/dist/server/connection-session.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +117 -4
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +2 -2
- package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +249 -0
- package/node_modules/@maka/runtime-host/dist/server/extension-package-manifest.js +262 -0
- package/node_modules/@maka/runtime-host/dist/server/host-change-feed.js +11 -0
- package/node_modules/@maka/runtime-host/dist/server/index.js +5 -0
- package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +181 -13
- package/node_modules/@maka/runtime-host/dist/server/interaction-projection.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +88 -22
- package/node_modules/@maka/runtime-host/dist/server/model-metadata-refresh.js +96 -0
- package/node_modules/@maka/runtime-host/dist/server/operation-dispatcher.js +43 -118
- package/node_modules/@maka/runtime-host/dist/server/plugin-composition-patch.js +58 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-composition-store.js +141 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-package-loader.js +130 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-package-store.js +528 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +249 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +1130 -0
- package/node_modules/@maka/runtime-host/dist/server/root-admission-owner.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +24 -5
- package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +29 -4
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +2 -1
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +10 -2
- package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +276 -3
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +101 -1
- package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +1 -0
- package/node_modules/@maka/runtime-host/dist/webrtc-stun-policy.js +114 -0
- package/node_modules/@maka/runtime-host/package.json +2 -0
- package/node_modules/@maka/storage/dist/agent-run-store.js +4 -0
- package/node_modules/@maka/storage/dist/artifact-store.js +7 -23
- package/node_modules/@maka/storage/dist/conversation-operational-state.js +3 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +3 -0
- package/node_modules/@maka/storage/dist/interaction-store-public.js +1 -1
- package/node_modules/@maka/storage/dist/interaction-store.js +173 -0
- package/node_modules/@maka/storage/dist/production-session-snapshot.js +761 -0
- package/node_modules/@maka/storage/dist/quiescent-session-snapshot.js +1 -1
- package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +19 -22
- package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +16 -36
- package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +2 -2
- package/node_modules/@maka/storage/dist/runtime-policy-stores.js +1 -1
- package/node_modules/@maka/storage/dist/session-message-projection.js +1 -1
- package/node_modules/@maka/storage/dist/session-store.js +32 -6
- package/node_modules/@maka/storage/dist/session-todo-store.js +6 -68
- package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +19 -0
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +10 -1
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +73 -3
- package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +2 -10
- package/node_modules/@maka/storage/package.json +2 -0
- package/package.json +1 -1
- package/node_modules/@maka/core/dist/task-ledger.js +0 -669
- package/node_modules/@maka/storage/dist/task-ledger-authority.js +0 -121
- package/node_modules/@maka/storage/dist/task-ledger-store.js +0 -663
package/dist/pi-tui-runner.js
CHANGED
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
import { randomUUID } from 'node:crypto';
|
|
20
20
|
import { basename } from 'node:path';
|
|
21
21
|
import { Key, ProcessTerminal, SelectList, TuiMainScreen, isKeyRelease, isKeyRepeat, matchesKey, } from '@earendil-works/pi-tui';
|
|
22
|
-
import { isThinkingLevel
|
|
22
|
+
import { isThinkingLevel } from '@maka/core/model-thinking';
|
|
23
23
|
import { projectRevisionLinkedSessionTree } from '@maka/core/session-revisions';
|
|
24
24
|
import { slashCommandsForSurface, } from '@maka/core/slash-command-catalog';
|
|
25
25
|
import { latestAssistantModelId, } from '@maka/core/session';
|
|
26
|
+
import { defineUiMessageCatalog, formatUiMessage, resolveUiMessageCatalog, } from '@maka/core/ui-locale';
|
|
26
27
|
import { buildForeignSessionHandoffMessage, foreignSessionHandoffDisplayText, foreignSourceLabel, } from '@maka/core/foreign-session';
|
|
27
28
|
import { listApiKeyOnboardableProviders } from './onboarding-catalog.js';
|
|
28
29
|
import { AUTO_RECAP_DISPLAY_LIMIT_BYTES, shouldAutoRecap } from './session-recap.js';
|
|
@@ -36,6 +37,8 @@ import { runMakaPiTuiTurn } from './pi-tui-turn.js';
|
|
|
36
37
|
import { editorTheme, selectListTheme } from './tui-ansi.js';
|
|
37
38
|
import { MakaAutocompleteAboveEditorComponent } from './tui-autocomplete-layout.js';
|
|
38
39
|
import { TranscriptViewerOverlay } from './pi-tui-transcript-viewer.js';
|
|
40
|
+
import { copyToClipboard } from './tui-clipboard.js';
|
|
41
|
+
import { getTuiCopyCopy, lastAssistantText, serializeTranscriptText } from './tui-copy-command.js';
|
|
39
42
|
import { McpManagementOverlay } from './pi-tui-mcp-status.js';
|
|
40
43
|
import { createShellRunElapsedTicker } from './shell-run-elapsed-ticker.js';
|
|
41
44
|
import { createShellRunHydrationController } from './shell-run-hydration.js';
|
|
@@ -46,6 +49,7 @@ import { MakaAutocompleteProvider, DirectoryPickerOverlay, ModelSearchOverlay, O
|
|
|
46
49
|
import { formatMakaResumeCommand } from './cli-invocation.js';
|
|
47
50
|
import { goalAttachedNoticeText, goalPausedNoticeText, goalStatusLabel, goalSummaryLines, isLiveGoalStatus, } from './pi-goal.js';
|
|
48
51
|
import { getTuiPrimaryGuidance } from './tui-primary-guidance.js';
|
|
52
|
+
import { TUI_COPY_RESOURCES } from './tui-copy-catalog.js';
|
|
49
53
|
export function resolveTaskbarProgress(setting, environment = {
|
|
50
54
|
platform: process.platform,
|
|
51
55
|
override: process.env.MAKA_TASKBAR_PROGRESS,
|
|
@@ -84,38 +88,34 @@ export function safeBoundaryResumeParkedCopy(reason) {
|
|
|
84
88
|
return { level: 'error', text: `Safe-boundary resume parked: ${reason}` };
|
|
85
89
|
}
|
|
86
90
|
}
|
|
91
|
+
const TUI_REWIND_COPY = resolveUiMessageCatalog(defineUiMessageCatalog()(TUI_COPY_RESOURCES.rewind));
|
|
92
|
+
const TUI_SKILLS_COPY = resolveUiMessageCatalog(defineUiMessageCatalog()(TUI_COPY_RESOURCES.skills));
|
|
93
|
+
const TUI_CONNECTION_IDENTITY_COPY = resolveUiMessageCatalog(defineUiMessageCatalog()(TUI_COPY_RESOURCES['connection-identity']));
|
|
94
|
+
const TUI_SESSION_ACTIONS_COPY = resolveUiMessageCatalog(defineUiMessageCatalog()(TUI_COPY_RESOURCES['session-actions']));
|
|
87
95
|
function sessionConnectionIdentityNotice(session, identities, locale) {
|
|
88
96
|
if (!identities)
|
|
89
97
|
return undefined;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
: 'If /model has no choices, add or enable a connection first (run /setup for API-key connections).';
|
|
98
|
+
const copy = TUI_CONNECTION_IDENTITY_COPY[locale];
|
|
99
|
+
const withRecovery = (notice) => formatUiMessage(copy.withRecovery, { notice, recovery: copy.emptyChoiceRecovery }, locale);
|
|
93
100
|
if (!session.llmConnectionId) {
|
|
94
|
-
return
|
|
95
|
-
? `此任务来自旧版本,需要确认一次账号。运行 /model 选择现有账号和模型。${emptyChoiceRecovery}`
|
|
96
|
-
: `This task comes from an older version and needs a one-time account confirmation. Run /model and choose an existing account and model. ${emptyChoiceRecovery}`;
|
|
101
|
+
return withRecovery(copy.confirmAccount);
|
|
97
102
|
}
|
|
98
103
|
const identified = identities.find((entry) => entry.connectionId === session.llmConnectionId);
|
|
99
104
|
if (!identified) {
|
|
100
|
-
return
|
|
101
|
-
? `原账号已删除;运行 /model 选择新账号和模型后继续。${emptyChoiceRecovery}`
|
|
102
|
-
: `The original account was deleted. Run /model and choose a new account and model to continue. ${emptyChoiceRecovery}`;
|
|
105
|
+
return withRecovery(copy.accountDeleted);
|
|
103
106
|
}
|
|
104
107
|
if (identified.connectionSlug !== session.llmConnectionSlug) {
|
|
105
|
-
return
|
|
106
|
-
? `任务保存的账号身份与当前连接不一致;运行 /model 重新选择账号和模型。${emptyChoiceRecovery}`
|
|
107
|
-
: `The saved account identity no longer matches its connection. Run /model and choose an account and model again. ${emptyChoiceRecovery}`;
|
|
108
|
+
return withRecovery(copy.identityMismatch);
|
|
108
109
|
}
|
|
109
110
|
if (!identified.enabled) {
|
|
110
|
-
return
|
|
111
|
-
? `原账号已停用;请启用该账号,或运行 /model 选择新账号和模型。${emptyChoiceRecovery}`
|
|
112
|
-
: `The original account is disabled. Enable it, or run /model and choose a new account and model. ${emptyChoiceRecovery}`;
|
|
111
|
+
return withRecovery(copy.accountDisabled);
|
|
113
112
|
}
|
|
114
113
|
return undefined;
|
|
115
114
|
}
|
|
116
115
|
export async function runMakaPiTui(input) {
|
|
117
116
|
const locale = input.locale ?? 'en';
|
|
118
117
|
const pickerCopy = getTuiPickerCopy(locale);
|
|
118
|
+
const copyCopy = getTuiCopyCopy(locale);
|
|
119
119
|
const primaryGuidance = getTuiPrimaryGuidance(locale);
|
|
120
120
|
const terminal = input.terminal ?? new ProcessTerminal();
|
|
121
121
|
const taskbarProgress = resolveTaskbarProgress(input.taskbarProgress);
|
|
@@ -141,18 +141,9 @@ export async function runMakaPiTui(input) {
|
|
|
141
141
|
let model = input.model;
|
|
142
142
|
let connectionId = input.connectionId;
|
|
143
143
|
let connectionSlug = input.connectionSlug;
|
|
144
|
-
// Mutable: a cross-connection /model switch rebinds the provider, which changes
|
|
145
|
-
// both the connection and the thinking variants the new model supports.
|
|
146
|
-
let providerType = input.providerType;
|
|
147
|
-
let modelContextWindow = input.modelContextWindow;
|
|
148
144
|
let permissionMode = input.permissionMode;
|
|
149
145
|
let orchestrationMode = input.driver.getOrchestrationMode?.() ?? 'default';
|
|
150
146
|
let thinkingLevel = undefined;
|
|
151
|
-
// The boot connection's declared capabilities win (an openai-compatible
|
|
152
|
-
// relay can declare relayModelProfiles[model].thinkingLevels). The
|
|
153
|
-
// providerType+model metadata variant is the fallback for modelChoices-free
|
|
154
|
-
// embeddings of the runner.
|
|
155
|
-
let thinkingLevels = input.modelChoices?.find((choice) => choice.connectionSlug === connectionSlug && choice.model === model)?.thinkingLevels ?? (providerType ? thinkingVariantsForModel(providerType, model) : []);
|
|
156
147
|
let sessionListScope = input.sessionListScope ?? 'current';
|
|
157
148
|
let connectionIdentityNotice;
|
|
158
149
|
let busy = false;
|
|
@@ -292,11 +283,11 @@ export async function runMakaPiTui(input) {
|
|
|
292
283
|
permissionMode,
|
|
293
284
|
orchestrationMode,
|
|
294
285
|
thinkingLevel,
|
|
295
|
-
thinkingLevels,
|
|
286
|
+
thinkingLevels: currentThinkingLevels(),
|
|
296
287
|
sessionId: input.driver.getSessionId(),
|
|
297
288
|
busy,
|
|
298
289
|
usage: state.usage,
|
|
299
|
-
modelContextWindow,
|
|
290
|
+
modelContextWindow: currentModelContextWindow(),
|
|
300
291
|
turnElapsedMs: turnStartedAt !== undefined ? Date.now() - turnStartedAt : undefined,
|
|
301
292
|
providerRetry: state.providerRetry,
|
|
302
293
|
uiLocale: locale,
|
|
@@ -314,7 +305,7 @@ export async function runMakaPiTui(input) {
|
|
|
314
305
|
});
|
|
315
306
|
const transcript = new MakaTranscriptComponent(state, metadata);
|
|
316
307
|
const activityStrip = new MakaActivityStripComponent(metadata);
|
|
317
|
-
const pendingQueue = new MakaPendingQueueComponent(state);
|
|
308
|
+
const pendingQueue = new MakaPendingQueueComponent(state, locale);
|
|
318
309
|
const statusLine = new MakaStatusLineComponent(metadata);
|
|
319
310
|
// Use the vendor editor's full 20-item autocomplete capacity. Larger command
|
|
320
311
|
// catalogs remain scrollable and keep an exact position/total counter.
|
|
@@ -454,30 +445,31 @@ export async function runMakaPiTui(input) {
|
|
|
454
445
|
// Warm the highlight validator so tokens light up before the first
|
|
455
446
|
// autocomplete or picker open.
|
|
456
447
|
void listSkillsCached(true);
|
|
457
|
-
const
|
|
458
|
-
not_found: '未找到',
|
|
459
|
-
disabled: '已禁用',
|
|
460
|
-
host_incompatible: '当前主机缺少其依赖的工具',
|
|
461
|
-
invalid_name: '名称无效',
|
|
462
|
-
too_many_requests: '调用请求过多',
|
|
463
|
-
};
|
|
448
|
+
const skillsCopy = TUI_SKILLS_COPY[locale];
|
|
464
449
|
const showSkillInvocation = (skillInvocation) => {
|
|
465
450
|
const failed = skillInvocation.failed;
|
|
466
451
|
const failedLabels = failed.map((entry) => entry.reason === 'too_many_requests'
|
|
467
|
-
?
|
|
468
|
-
:
|
|
452
|
+
? formatUiMessage(skillsCopy.tooManyRequestsItem, { limit: entry.requestLimit, reason: skillsCopy.failureReasons[entry.reason] }, locale)
|
|
453
|
+
: formatUiMessage(skillsCopy.failedItem, { request: entry.request, reason: skillsCopy.failureReasons[entry.reason] }, locale));
|
|
469
454
|
if (failed.length > 0) {
|
|
470
455
|
state.entries.push({
|
|
471
456
|
kind: 'notice',
|
|
472
457
|
level: 'info',
|
|
473
|
-
text:
|
|
458
|
+
text: formatUiMessage(skillsCopy.loadFailed, {
|
|
459
|
+
failures: failedLabels.join(skillsCopy.listSeparator),
|
|
460
|
+
outcome: skillInvocation.loaded.length === 0
|
|
461
|
+
? skillsCopy.outcomeNoRequest
|
|
462
|
+
: skillsCopy.outcomeMarkersNotSent,
|
|
463
|
+
}, locale),
|
|
474
464
|
});
|
|
475
465
|
}
|
|
476
466
|
if (skillInvocation.loaded.length > 0) {
|
|
477
467
|
state.entries.push({
|
|
478
468
|
kind: 'notice',
|
|
479
469
|
level: 'info',
|
|
480
|
-
text:
|
|
470
|
+
text: formatUiMessage(skillsCopy.loaded, {
|
|
471
|
+
names: skillInvocation.loaded.map((skill) => skill.name).join(skillsCopy.listSeparator),
|
|
472
|
+
}, locale),
|
|
481
473
|
});
|
|
482
474
|
}
|
|
483
475
|
requestRender();
|
|
@@ -564,8 +556,10 @@ export async function runMakaPiTui(input) {
|
|
|
564
556
|
process.off('uncaughtException', handleUncaughtException);
|
|
565
557
|
process.off('unhandledRejection', handleUnhandledRejection);
|
|
566
558
|
};
|
|
559
|
+
let unsubscribeModelCatalogChanges;
|
|
567
560
|
const restoreTerminal = () => {
|
|
568
561
|
removeProcessHandlers();
|
|
562
|
+
unsubscribeModelCatalogChanges?.();
|
|
569
563
|
unsubscribeSessionTitleChanges();
|
|
570
564
|
unsubscribeGoalChanges?.();
|
|
571
565
|
void sideConversation?.stopParentObserver?.();
|
|
@@ -871,6 +865,33 @@ export async function runMakaPiTui(input) {
|
|
|
871
865
|
// available — the single source the picker and connection/model lookups read.
|
|
872
866
|
let modelChoices = input.modelChoices;
|
|
873
867
|
let connectionIdentities = input.connectionIdentities;
|
|
868
|
+
// Derived, never mirrored: both the choices and the selected target move —
|
|
869
|
+
// the Host republishes its catalog, the user switches model — and a stored
|
|
870
|
+
// copy of what the two imply has to be resynchronized at every one of those
|
|
871
|
+
// points or go stale at the one that was missed.
|
|
872
|
+
// The slug and model identify the target; the id narrows it only once the
|
|
873
|
+
// caller or a session summary has supplied one, because two connections can
|
|
874
|
+
// share a slug across a rebind but a caller need not know either id.
|
|
875
|
+
const currentModelChoice = () => modelChoices?.find((choice) => choice.connectionSlug === connectionSlug &&
|
|
876
|
+
choice.model === model &&
|
|
877
|
+
(connectionId === undefined || choice.connectionId === connectionId));
|
|
878
|
+
const onInitialTarget = () => connectionId === input.connectionId &&
|
|
879
|
+
connectionSlug === input.connectionSlug &&
|
|
880
|
+
model === input.model;
|
|
881
|
+
/** The caller's value stands only while no choice describes the target it came with. */
|
|
882
|
+
const currentModelContextWindow = () => currentModelChoice()?.contextWindow ??
|
|
883
|
+
(onInitialTarget() ? input.modelContextWindow : undefined);
|
|
884
|
+
// The Host resolved these when it projected the choice — including a relay's
|
|
885
|
+
// declared `relayModelProfiles[model].thinkingLevels`. A model no choice
|
|
886
|
+
// describes offers none rather than a locally guessed list.
|
|
887
|
+
const currentThinkingLevels = () => currentModelChoice()?.thinkingLevels ?? [];
|
|
888
|
+
unsubscribeModelCatalogChanges = input.subscribeModelCatalogChanges?.((refresh) => {
|
|
889
|
+
if (closed)
|
|
890
|
+
return;
|
|
891
|
+
modelChoices = refresh.modelChoices;
|
|
892
|
+
connectionIdentities = refresh.connectionIdentities;
|
|
893
|
+
requestRender();
|
|
894
|
+
});
|
|
874
895
|
// Monotonic attempt id: each setup submit captures one, and any transition
|
|
875
896
|
// that abandons the in-flight attempt (back, re-pick, close) increments it so
|
|
876
897
|
// a late verify/save settlement cannot clobber a newer attempt.
|
|
@@ -1137,9 +1158,6 @@ export async function runMakaPiTui(input) {
|
|
|
1137
1158
|
const adoptSessionMetadata = (summary, announceIdentity = true) => {
|
|
1138
1159
|
cwd = summary.cwd ?? cwd;
|
|
1139
1160
|
setSessionTitle(summary.name);
|
|
1140
|
-
const previousModel = model;
|
|
1141
|
-
const previousConnectionId = connectionId;
|
|
1142
|
-
const previousConnectionSlug = connectionSlug;
|
|
1143
1161
|
model = summary.model;
|
|
1144
1162
|
connectionId = summary.llmConnectionId;
|
|
1145
1163
|
connectionSlug = summary.llmConnectionSlug;
|
|
@@ -1148,34 +1166,9 @@ export async function runMakaPiTui(input) {
|
|
|
1148
1166
|
state.entries.push({ kind: 'notice', level: 'error', text: identityNotice });
|
|
1149
1167
|
}
|
|
1150
1168
|
connectionIdentityNotice = identityNotice;
|
|
1151
|
-
const matchingChoice = modelChoices?.find((choice) => choice.connectionId === summary.llmConnectionId &&
|
|
1152
|
-
choice.connectionSlug === summary.llmConnectionSlug);
|
|
1153
|
-
providerType =
|
|
1154
|
-
matchingChoice?.providerType ??
|
|
1155
|
-
(previousConnectionId === summary.llmConnectionId &&
|
|
1156
|
-
previousConnectionSlug === summary.llmConnectionSlug
|
|
1157
|
-
? providerType
|
|
1158
|
-
: undefined);
|
|
1159
|
-
const contextWindowMatch = modelChoices?.find((choice) => choice.connectionId === summary.llmConnectionId &&
|
|
1160
|
-
choice.connectionSlug === summary.llmConnectionSlug &&
|
|
1161
|
-
choice.model === summary.model);
|
|
1162
|
-
if (contextWindowMatch) {
|
|
1163
|
-
modelContextWindow = contextWindowMatch.contextWindow;
|
|
1164
|
-
}
|
|
1165
|
-
else if (previousConnectionId !== summary.llmConnectionId ||
|
|
1166
|
-
previousConnectionSlug !== summary.llmConnectionSlug ||
|
|
1167
|
-
previousModel !== summary.model) {
|
|
1168
|
-
modelContextWindow = undefined;
|
|
1169
|
-
}
|
|
1170
1169
|
permissionMode = input.driver.getPermissionMode?.() ?? summary.permissionMode;
|
|
1171
1170
|
orchestrationMode = summary.orchestrationMode ?? 'default';
|
|
1172
1171
|
thinkingLevel = summary.thinkingLevel;
|
|
1173
|
-
// Choice-first: a relay model's user-declared levels live on the ModelChoice;
|
|
1174
|
-
// the metadata fallback serves providers whose variants derive from the
|
|
1175
|
-
// model id alone.
|
|
1176
|
-
thinkingLevels =
|
|
1177
|
-
contextWindowMatch?.thinkingLevels ??
|
|
1178
|
-
(providerType ? thinkingVariantsForModel(providerType, summary.model) : []);
|
|
1179
1172
|
refreshEditorCwd?.(cwd);
|
|
1180
1173
|
};
|
|
1181
1174
|
startAttachedTurn = (attached) => {
|
|
@@ -1189,16 +1182,7 @@ export async function runMakaPiTui(input) {
|
|
|
1189
1182
|
const previousModel = transcriptLastUsedModel ?? model;
|
|
1190
1183
|
await input.driver.setModel(nextModel);
|
|
1191
1184
|
model = nextModel;
|
|
1192
|
-
// Same-connection switch: scope the choice lookup to the live connection
|
|
1193
|
-
// (another connection may expose the same model id with different
|
|
1194
|
-
// declared thinking levels).
|
|
1195
|
-
const match = modelChoices?.find((choice) => choice.connectionSlug === connectionSlug && choice.model === nextModel);
|
|
1196
|
-
if (match)
|
|
1197
|
-
modelContextWindow = match.contextWindow;
|
|
1198
1185
|
thinkingLevel = undefined;
|
|
1199
|
-
thinkingLevels =
|
|
1200
|
-
match?.thinkingLevels ??
|
|
1201
|
-
(providerType ? thinkingVariantsForModel(providerType, nextModel) : []);
|
|
1202
1186
|
state.entries.push({
|
|
1203
1187
|
kind: 'notice',
|
|
1204
1188
|
level: 'info',
|
|
@@ -1214,9 +1198,6 @@ export async function runMakaPiTui(input) {
|
|
|
1214
1198
|
choice.connectionId === connectionId) {
|
|
1215
1199
|
return;
|
|
1216
1200
|
}
|
|
1217
|
-
if (!choice.connectionId) {
|
|
1218
|
-
throw new Error('Model choice is missing its exact Connection identity');
|
|
1219
|
-
}
|
|
1220
1201
|
const previousModel = transcriptLastUsedModel ?? model;
|
|
1221
1202
|
const previousConnectionSlug = connectionSlug;
|
|
1222
1203
|
const connectionLabels = modelChoiceConnectionLabels(modelChoices ?? [choice]);
|
|
@@ -1224,11 +1205,7 @@ export async function runMakaPiTui(input) {
|
|
|
1224
1205
|
model = choice.model;
|
|
1225
1206
|
connectionId = choice.connectionId;
|
|
1226
1207
|
connectionSlug = choice.connectionSlug;
|
|
1227
|
-
providerType = choice.providerType;
|
|
1228
|
-
modelContextWindow = choice.contextWindow;
|
|
1229
1208
|
thinkingLevel = undefined;
|
|
1230
|
-
thinkingLevels =
|
|
1231
|
-
choice.thinkingLevels ?? thinkingVariantsForModel(choice.providerType, choice.model);
|
|
1232
1209
|
state.entries.push({
|
|
1233
1210
|
kind: 'notice',
|
|
1234
1211
|
level: 'info',
|
|
@@ -1589,7 +1566,7 @@ export async function runMakaPiTui(input) {
|
|
|
1589
1566
|
const pendingNotice = {
|
|
1590
1567
|
kind: 'notice',
|
|
1591
1568
|
level: 'info',
|
|
1592
|
-
text:
|
|
1569
|
+
text: TUI_REWIND_COPY[locale].pending,
|
|
1593
1570
|
};
|
|
1594
1571
|
state.entries.push(pendingNotice);
|
|
1595
1572
|
requestRender();
|
|
@@ -1615,9 +1592,7 @@ export async function runMakaPiTui(input) {
|
|
|
1615
1592
|
state.entries.push({
|
|
1616
1593
|
kind: 'notice',
|
|
1617
1594
|
level: 'info',
|
|
1618
|
-
text: refill
|
|
1619
|
-
? '已回退到该轮之前(分支为新任务,原任务保留),该轮 prompt 已回填输入框,可修改后重新发送。'
|
|
1620
|
-
: '已回退到该轮之前(分支为新任务,原任务保留)。输入框已有未发送内容,未覆盖;该轮 prompt 已存入输入历史,可按 ↑ 找回。',
|
|
1595
|
+
text: refill ? TUI_REWIND_COPY[locale].doneRefilled : TUI_REWIND_COPY[locale].doneKeptDraft,
|
|
1621
1596
|
});
|
|
1622
1597
|
requestRender();
|
|
1623
1598
|
}
|
|
@@ -1807,7 +1782,6 @@ export async function runMakaPiTui(input) {
|
|
|
1807
1782
|
apiKey: wizardApiKey,
|
|
1808
1783
|
baseUrl: wizardBaseUrl,
|
|
1809
1784
|
enabledModelIds,
|
|
1810
|
-
models: wizardModels,
|
|
1811
1785
|
})
|
|
1812
1786
|
.then((result) => {
|
|
1813
1787
|
if (result.kind !== 'ok') {
|
|
@@ -2113,13 +2087,16 @@ export async function runMakaPiTui(input) {
|
|
|
2113
2087
|
// prefixed select value so they never collide with Maka session ids. A scan
|
|
2114
2088
|
// error is surfaced (not silently swallowed): degrade to no rows but tell
|
|
2115
2089
|
// the user why, so a real store bug isn't mistaken for "no sessions".
|
|
2090
|
+
// Deliberate #2672 exception: the interpolated detail is a local
|
|
2091
|
+
// file-scan diagnostic (not backend copy) and the TUI has no log channel
|
|
2092
|
+
// to carry it, so dropping it would hide the only debugging signal.
|
|
2116
2093
|
const foreignByValue = new Map();
|
|
2117
2094
|
if ('error' in foreignScan) {
|
|
2118
2095
|
const detail = foreignScan.error instanceof Error ? foreignScan.error.message : String(foreignScan.error);
|
|
2119
2096
|
state.entries.push({
|
|
2120
2097
|
kind: 'notice',
|
|
2121
2098
|
level: 'error',
|
|
2122
|
-
text:
|
|
2099
|
+
text: formatUiMessage(TUI_SESSION_ACTIONS_COPY[locale].foreignScanFailed, { detail }, locale),
|
|
2123
2100
|
});
|
|
2124
2101
|
}
|
|
2125
2102
|
else {
|
|
@@ -2201,7 +2178,7 @@ export async function runMakaPiTui(input) {
|
|
|
2201
2178
|
state.entries.push({
|
|
2202
2179
|
kind: 'notice',
|
|
2203
2180
|
level: 'info',
|
|
2204
|
-
text:
|
|
2181
|
+
text: TUI_REWIND_COPY[locale].noTargets,
|
|
2205
2182
|
});
|
|
2206
2183
|
requestRender();
|
|
2207
2184
|
return;
|
|
@@ -2210,7 +2187,8 @@ export async function runMakaPiTui(input) {
|
|
|
2210
2187
|
value: target.turnId,
|
|
2211
2188
|
label: target.label,
|
|
2212
2189
|
}));
|
|
2213
|
-
|
|
2190
|
+
const rewindCopy = TUI_REWIND_COPY[locale];
|
|
2191
|
+
showSelectPicker(rewindCopy.pickerTitle, rewindCopy.pickerTitle, items, (item) => {
|
|
2214
2192
|
// runControl drops the action silently when busy is already held (e.g.
|
|
2215
2193
|
// a Goal auto-continuation started while the picker was open). The
|
|
2216
2194
|
// overlay is already closed at this point, so say so instead of
|
|
@@ -2219,7 +2197,7 @@ export async function runMakaPiTui(input) {
|
|
|
2219
2197
|
state.entries.push({
|
|
2220
2198
|
kind: 'notice',
|
|
2221
2199
|
level: 'error',
|
|
2222
|
-
text:
|
|
2200
|
+
text: rewindCopy.busy,
|
|
2223
2201
|
});
|
|
2224
2202
|
requestRender();
|
|
2225
2203
|
return;
|
|
@@ -2228,23 +2206,22 @@ export async function runMakaPiTui(input) {
|
|
|
2228
2206
|
}, {
|
|
2229
2207
|
minPrimaryColumnWidth: 24,
|
|
2230
2208
|
maxPrimaryColumnWidth: 48,
|
|
2231
|
-
hint:
|
|
2209
|
+
hint: rewindCopy.pickerHint,
|
|
2232
2210
|
});
|
|
2233
2211
|
};
|
|
2234
2212
|
const newSession = async () => {
|
|
2235
2213
|
try {
|
|
2236
2214
|
await input.driver.startNewSession();
|
|
2237
2215
|
}
|
|
2238
|
-
catch
|
|
2216
|
+
catch {
|
|
2239
2217
|
// The identity swap was aborted driver-side: the previous Session, its
|
|
2240
2218
|
// transcript, and every user-command card stay exactly as they were.
|
|
2241
|
-
// Surface
|
|
2219
|
+
// Surface the failure instead of silently stranding the running
|
|
2220
|
+
// commands; the driver's raw error text is not product copy (#2672).
|
|
2242
2221
|
state.entries.push({
|
|
2243
2222
|
kind: 'notice',
|
|
2244
2223
|
level: 'error',
|
|
2245
|
-
text:
|
|
2246
|
-
? error.message
|
|
2247
|
-
: '无法开始新会话:停止本地命令失败,请稍后重试。',
|
|
2224
|
+
text: TUI_SESSION_ACTIONS_COPY[locale].newSessionFailed,
|
|
2248
2225
|
});
|
|
2249
2226
|
requestRender();
|
|
2250
2227
|
return false;
|
|
@@ -2400,18 +2377,18 @@ export async function runMakaPiTui(input) {
|
|
|
2400
2377
|
state.entries.push({
|
|
2401
2378
|
kind: 'notice',
|
|
2402
2379
|
level: 'info',
|
|
2403
|
-
text:
|
|
2380
|
+
text: skillsCopy.noneAvailable,
|
|
2404
2381
|
});
|
|
2405
2382
|
requestRender();
|
|
2406
2383
|
return;
|
|
2407
2384
|
}
|
|
2408
|
-
showSelectPicker(
|
|
2385
|
+
showSelectPicker(skillsCopy.pickerTitle, String(entries.length), skillPickerItems(entries), (item) => {
|
|
2409
2386
|
editor.insertTextAtCursor(`/skill:${item.value} `);
|
|
2410
2387
|
requestRender();
|
|
2411
2388
|
}, { minPrimaryColumnWidth: 16, maxPrimaryColumnWidth: 40 });
|
|
2412
2389
|
};
|
|
2413
2390
|
const showThinkingLevelList = () => {
|
|
2414
|
-
const items = thinkingLevelPickerItems(
|
|
2391
|
+
const items = thinkingLevelPickerItems(currentThinkingLevels(), thinkingLevel, locale);
|
|
2415
2392
|
showSelectPicker(pickerCopy.thinkingPickerTitle, thinkingLevel ?? 'default', items, (item) => {
|
|
2416
2393
|
const level = item.value === 'default' ? undefined : item.value;
|
|
2417
2394
|
if (level !== undefined && !isThinkingLevel(level))
|
|
@@ -2808,6 +2785,59 @@ export async function runMakaPiTui(input) {
|
|
|
2808
2785
|
void runControl(compactSession);
|
|
2809
2786
|
},
|
|
2810
2787
|
},
|
|
2788
|
+
copy: {
|
|
2789
|
+
description: primaryGuidance.commands.copy,
|
|
2790
|
+
// Refused mid-turn: copy grabs the finished reply, and while a turn streams
|
|
2791
|
+
// the last assistant entry is the half-written one — copying that would
|
|
2792
|
+
// silently hand back a partial message. Wait for the turn (or Esc) first.
|
|
2793
|
+
midTurn: 'refuse',
|
|
2794
|
+
run: (parts) => {
|
|
2795
|
+
const scope = parts.length >= 2 ? parts[1] : undefined;
|
|
2796
|
+
if (parts.length > 2 || (scope !== undefined && scope !== 'all')) {
|
|
2797
|
+
state.entries.push({
|
|
2798
|
+
kind: 'notice',
|
|
2799
|
+
level: 'error',
|
|
2800
|
+
text: 'Usage: /copy [all]',
|
|
2801
|
+
});
|
|
2802
|
+
requestRender();
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2805
|
+
const copyAll = scope === 'all';
|
|
2806
|
+
const text = copyAll
|
|
2807
|
+
? serializeTranscriptText(state, {
|
|
2808
|
+
user: copyCopy.roleUser,
|
|
2809
|
+
assistant: copyCopy.roleAssistant,
|
|
2810
|
+
goalContinuation: copyCopy.roleGoalContinuation,
|
|
2811
|
+
legacyAutomation: copyCopy.roleLegacyAutomation,
|
|
2812
|
+
})
|
|
2813
|
+
: lastAssistantText(state);
|
|
2814
|
+
if (!text) {
|
|
2815
|
+
state.entries.push({
|
|
2816
|
+
kind: 'notice',
|
|
2817
|
+
level: 'info',
|
|
2818
|
+
text: copyCopy.nothingToCopy,
|
|
2819
|
+
});
|
|
2820
|
+
requestRender();
|
|
2821
|
+
return;
|
|
2822
|
+
}
|
|
2823
|
+
const result = copyToClipboard(terminal, text);
|
|
2824
|
+
if (!result.ok) {
|
|
2825
|
+
state.entries.push({
|
|
2826
|
+
kind: 'notice',
|
|
2827
|
+
level: 'error',
|
|
2828
|
+
text: formatUiMessage(copyCopy.tooLarge, { bytes: result.bytes, limit: result.limit }, locale),
|
|
2829
|
+
});
|
|
2830
|
+
requestRender();
|
|
2831
|
+
return;
|
|
2832
|
+
}
|
|
2833
|
+
state.entries.push({
|
|
2834
|
+
kind: 'notice',
|
|
2835
|
+
level: 'info',
|
|
2836
|
+
text: formatUiMessage(copyAll ? copyCopy.copiedAll : copyCopy.copiedLast, { count: text.length }, locale),
|
|
2837
|
+
});
|
|
2838
|
+
requestRender();
|
|
2839
|
+
},
|
|
2840
|
+
},
|
|
2811
2841
|
exit: {
|
|
2812
2842
|
description: primaryGuidance.commands.exit,
|
|
2813
2843
|
// isExitPrompt (which also matches bare "quit"/"exit" without a slash)
|
|
@@ -2896,7 +2926,7 @@ export async function runMakaPiTui(input) {
|
|
|
2896
2926
|
state.entries.push({
|
|
2897
2927
|
kind: 'notice',
|
|
2898
2928
|
level: 'error',
|
|
2899
|
-
text:
|
|
2929
|
+
text: skillsCopy.usage,
|
|
2900
2930
|
});
|
|
2901
2931
|
requestRender();
|
|
2902
2932
|
return;
|
|
@@ -2957,6 +2987,7 @@ export async function runMakaPiTui(input) {
|
|
|
2957
2987
|
description: primaryGuidance.commands.thinking,
|
|
2958
2988
|
midTurn: 'refuse',
|
|
2959
2989
|
run: (parts) => {
|
|
2990
|
+
const thinkingLevels = currentThinkingLevels();
|
|
2960
2991
|
if (parts.length === 1) {
|
|
2961
2992
|
if (thinkingLevels.length === 0) {
|
|
2962
2993
|
state.entries.push({
|