maka-agent 0.2.0-dev.44.20260920 → 0.2.0-dev.45.20260921

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.
Files changed (61) hide show
  1. package/dist/runtime-host-service-manager.js +1 -6
  2. package/dist/runtime-host-update-command.js +39 -27
  3. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  4. package/node_modules/@maka/core/dist/artifacts.js +1 -0
  5. package/node_modules/@maka/core/dist/model-metadata.js +1 -2
  6. package/node_modules/@maka/core/dist/provider-auth.js +1 -7
  7. package/node_modules/@maka/core/dist/provider-registry.js +13 -7
  8. package/node_modules/@maka/core/dist/recall.js +5 -1
  9. package/node_modules/@maka/core/dist/session-start-mode.js +2 -5
  10. package/node_modules/@maka/core/dist/session.js +0 -1
  11. package/node_modules/@maka/core/dist/settings.js +17 -0
  12. package/node_modules/@maka/core/dist/tool-quiet-preview.js +2 -16
  13. package/node_modules/@maka/core/dist/transcript-search.js +46 -0
  14. package/node_modules/@maka/core/package.json +1 -4
  15. package/node_modules/@maka/runtime/dist/model-factory.js +0 -16
  16. package/node_modules/@maka/runtime/dist/model-fetcher.js +1 -4
  17. package/node_modules/@maka/runtime/dist/model-runtime.js +0 -8
  18. package/node_modules/@maka/runtime/dist/recall-tools.js +4 -0
  19. package/node_modules/@maka/runtime/dist/session-manager.js +4 -13
  20. package/node_modules/@maka/runtime/dist/subagent-tools.js +69 -11
  21. package/node_modules/@maka/runtime/dist/test-connection.js +1 -48
  22. package/node_modules/@maka/runtime/package.json +0 -1
  23. package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +25 -18
  24. package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +3 -1
  25. package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +0 -108
  26. package/node_modules/@maka/runtime-host/dist/protocol/index.js +6 -1
  27. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +4 -5
  28. package/node_modules/@maka/runtime-host/dist/protocol/recall.js +270 -0
  29. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +1 -7
  30. package/node_modules/@maka/runtime-host/dist/protocol/usage-screen.js +12 -4
  31. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +4 -0
  32. package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +1 -57
  33. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +11 -33
  34. package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +3 -20
  35. package/node_modules/@maka/runtime-host/dist/server/recall-coordinator.js +117 -0
  36. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +0 -4
  37. package/node_modules/@maka/storage/dist/artifact-metadata-codec.js +4 -3
  38. package/node_modules/@maka/storage/dist/artifact-store.js +1 -11
  39. package/node_modules/@maka/storage/dist/process-lifetime-file-update-lock.js +0 -41
  40. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +0 -28
  41. package/node_modules/@maka/storage/dist/runtime-policy-stores.js +0 -2
  42. package/node_modules/@maka/storage/dist/sqlite-usage-schema.js +29 -5
  43. package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +2 -0
  44. package/node_modules/@maka/storage/dist/storage-writer-composition.js +0 -3
  45. package/node_modules/@maka/storage/dist/telemetry-file-schema.js +5 -3
  46. package/node_modules/@maka/storage/dist/usage-screen.js +5 -6
  47. package/node_modules/@maka/storage/dist/usage-stores.js +14 -4
  48. package/node_modules/@maka/storage/package.json +0 -2
  49. package/package.json +1 -1
  50. package/node_modules/@maka/core/dist/connection-usage.js +0 -27
  51. package/node_modules/@maka/core/dist/deep-research-client-progress.js +0 -132
  52. package/node_modules/@maka/core/dist/deep-research-run.js +0 -625
  53. package/node_modules/@maka/core/dist/deep-research.js +0 -208
  54. package/node_modules/@maka/core/dist/thread-search.js +0 -498
  55. package/node_modules/@maka/runtime/dist/commandcode-cli-language-model.js +0 -837
  56. package/node_modules/@maka/runtime/dist/connection-usage.js +0 -232
  57. package/node_modules/@maka/runtime/dist/deep-research-tools.js +0 -732
  58. package/node_modules/@maka/runtime-host/dist/protocol/deep-research.js +0 -233
  59. package/node_modules/@maka/runtime-host/dist/server/deep-research-coordinator.js +0 -116
  60. package/node_modules/@maka/storage/dist/deep-research-authority.js +0 -129
  61. package/node_modules/@maka/storage/dist/deep-research-store.js +0 -343
@@ -27,7 +27,7 @@ import { truncateUtf8 } from '@maka/core/diagnostic-log';
27
27
  import { canonicalProjectDirectoryRootSpec, isCanonicalRuntimeHostWebSocketPath, PROJECT_DIRECTORY_MAX_ROOTS, projectDirectoryRootSpecValid, RUNTIME_HOST_PROTOCOL_VERSION, } from '@maka/runtime-host/protocol';
28
28
  import { connectExistingRuntimeHost, prepareConnectedRuntimeHostRetirement, } from '@maka/runtime-host/client';
29
29
  import { resolveRuntimeHostManagedServiceId, RUNTIME_HOST_SERVICE_LOG_MAX_BYTES, } from '@maka/runtime-host/operator';
30
- import { withLegacyFileUpdateLockLease, withProcessLifetimeFileUpdateLock, } from '@maka/storage/process-lifetime-file-update-lock';
30
+ import { withProcessLifetimeFileUpdateLock } from '@maka/storage/process-lifetime-file-update-lock';
31
31
  import { discoverMarkedStorageRoot, resolveExistingStorageRoot, tryAcquireInteractiveRootOwner, } from '@maka/storage/root-authority';
32
32
  import { isRuntimeHostManagedDeploymentCli, removeRuntimeHostManagedDeployment, resolveExistingRuntimeHostManagedDeploymentRoot, resolveRuntimeHostManagedDeploymentForCli, resolveRuntimeHostManagedDeploymentRoot, } from './runtime-host-managed-deployment.js';
33
33
  import { writeRuntimeHostManagedUpdatePolicy } from './runtime-host-update-policy-store.js';
@@ -79,11 +79,6 @@ export async function withRuntimeHostManagedServiceDeploymentLock(clientDataRoot
79
79
  await mkdir(clientDataRoot, { recursive: true, mode: 0o700 });
80
80
  return withProcessLifetimeFileUpdateLock(join(clientDataRoot, SERVICE_DEPLOYMENT_LOCK_FILE), operation, timeoutMs);
81
81
  }
82
- export async function withRuntimeHostManagedServiceLegacyOperatorLeases(clientDataRoot, operation, timeoutMs = SERVICE_OPERATION_LOCK_TIMEOUT_MS) {
83
- const configPath = resolveRuntimeHostManagedServiceConfigPath(clientDataRoot);
84
- await mkdir(dirname(configPath), { recursive: true, mode: 0o700 });
85
- return withLegacyFileUpdateLockLease(join(clientDataRoot, SERVICE_LIFECYCLE_LOCK_FILE), (lifecycleFd) => withLegacyFileUpdateLockLease(configPath, (configFd) => operation([lifecycleFd, configFd]), timeoutMs), timeoutMs);
86
- }
87
82
  export async function replaceRuntimeHostManagedService(input, backend, overrides = {}) {
88
83
  const deps = runtimeHostServiceManagerDeps(overrides);
89
84
  const configPath = resolveRuntimeHostManagedServiceConfigPath(input.clientDataRoot);
@@ -22,7 +22,7 @@ import { truncateUtf8 } from '@maka/core/diagnostic-log';
22
22
  import { activateRuntimeHostManagedDeployment } from '@maka/runtime-host/client';
23
23
  import { compareProductReleaseVersions, createRuntimeHostLegacyPosixOperatorCommand, decodeRuntimeHostServiceManagementFrame, encodeRuntimeHostServiceManagementFrame, RUNTIME_HOST_SERVICE_ERROR_CODE_MAX_BYTES, RUNTIME_HOST_SERVICE_ERROR_MESSAGE_MAX_BYTES, RUNTIME_HOST_OPERATOR_ACCESS_MANAGEMENT_CAPABILITY, RUNTIME_HOST_OPERATOR_CAPABILITY_REQUEST_ENV, RUNTIME_HOST_OPERATOR_PROCESS_LIFETIME_LOCK_CAPABILITY, runtimeHostOperatorInvocation, RuntimeHostManagedDeploymentError as RuntimeHostDeploymentAuthorityError, } from '@maka/runtime-host/operator';
24
24
  import { isRuntimeHostDevelopmentPackageVersion, assertRuntimeHostManagedOperatorConfig, assertRuntimeHostManagedOperatorDeployment, convergeRuntimeHostManagedOperator, verifyRuntimeHostManagedOperator, openRuntimeHostManagedPackageDeployment, prepareRuntimeHostManagedPackageDeployment, pruneRuntimeHostManagedPackages, resolveRuntimeHostManagedControlRoot, resolveRuntimeHostManagedPackageCliPath, RuntimeHostManagedDeploymentError, } from './runtime-host-managed-deployment.js';
25
- import { runtimeHostManagedServiceConfigFingerprint, manageRuntimeHostService, replaceRuntimeHostManagedService, resolveRuntimeHostManagedServiceId, RuntimeHostServiceManagerError, verifyRuntimeHostManagedServiceReady, withRuntimeHostManagedServiceDeploymentLock, withRuntimeHostManagedServiceLegacyOperatorLeases, withRuntimeHostManagedServiceLifecycleLock, } from './runtime-host-service-manager.js';
25
+ import { runtimeHostManagedServiceConfigFingerprint, manageRuntimeHostService, replaceRuntimeHostManagedService, resolveRuntimeHostManagedServiceId, RuntimeHostServiceManagerError, verifyRuntimeHostManagedServiceReady, withRuntimeHostManagedServiceDeploymentLock, withRuntimeHostManagedServiceLifecycleLock, } from './runtime-host-service-manager.js';
26
26
  import { createPlatformRuntimeHostServiceBackend, resolveRuntimeHostLifecycleProvider, runtimeHostServiceSummary, } from './runtime-host-service-management-command.js';
27
27
  import { resolveManagedRuntimeHostUpdateSelection, RuntimeHostUpdateDiscoveryError, } from './runtime-host-update-discovery.js';
28
28
  import { RuntimeHostUpdatePackageError, withRuntimeHostRegistryUpdatePackage, } from './runtime-host-update-package.js';
@@ -60,7 +60,6 @@ export async function runManagedRuntimeHostUpdateCli(options, overrides = {}, fr
60
60
  }),
61
61
  withLifecycleLock: withRuntimeHostManagedServiceLifecycleLock,
62
62
  withDeploymentLock: withRuntimeHostManagedServiceDeploymentLock,
63
- withLegacyOperatorLeases: withRuntimeHostManagedServiceLegacyOperatorLeases,
64
63
  createBackend: createPlatformRuntimeHostServiceBackend,
65
64
  verifyReady: verifyRuntimeHostManagedServiceReady,
66
65
  runOperator: runManagedRuntimeHostOperator,
@@ -170,19 +169,48 @@ export async function runManagedRuntimeHostUpdateCli(options, overrides = {}, fr
170
169
  }
171
170
  }
172
171
  const currentOperator = createRuntimeHostLegacyPosixOperatorCommand(join(serviceConfig.managedDeploymentRoot, 'operator'));
173
- let currentOperatorUsesProcessLifetimeLock = false;
174
172
  let currentOperatorUnavailable = false;
175
173
  if (status.service.active) {
174
+ let probeSupportsLifetimeLock = false;
176
175
  try {
177
- currentOperatorUsesProcessLifetimeLock = operatorUsesProcessLifetimeLock(await deps.runOperator(currentOperator, ['status', '--framed', ...expectedTargetArgs(options.expectedTarget)], {
176
+ const probe = await deps.runOperator(currentOperator, ['status', '--framed', ...expectedTargetArgs(options.expectedTarget)], {
178
177
  capabilityRequest: RUNTIME_HOST_OPERATOR_PROCESS_LIFETIME_LOCK_CAPABILITY,
179
- }));
178
+ });
179
+ if (probe.kind === 'error') {
180
+ throw new RuntimeHostServiceManagerError('service_manager_operation_failed', `The current Runtime Host operator could not report its status: ${probe.error.message}`);
181
+ }
182
+ if (probe.action !== 'status') {
183
+ throw new Error('The current Runtime Host operator returned an invalid status result');
184
+ }
185
+ probeSupportsLifetimeLock =
186
+ probe.operatorCapabilities?.includes(RUNTIME_HOST_OPERATOR_PROCESS_LIFETIME_LOCK_CAPABILITY) ?? false;
180
187
  }
181
188
  catch (error) {
182
189
  if (!activeTargetNeedsRepair)
183
190
  throw error;
184
191
  currentOperatorUnavailable = true;
185
192
  }
193
+ // An operator that answered but cannot echo the requested
194
+ // capability predates the lifetime-lock protocol; retiring it would
195
+ // race unmanaged service state, so it must be removed before
196
+ // updating. This verdict is not a probe failure: it must refuse
197
+ // even when the target needs repair (where the catch above would
198
+ // degrade it to an unavailable operator), and nothing has been
199
+ // mutated yet — emitting directly keeps the instruction visible
200
+ // instead of folding it into the post-mutation "update_incomplete"
201
+ // remap.
202
+ if (!currentOperatorUnavailable && !probeSupportsLifetimeLock) {
203
+ emit({
204
+ schemaVersion: 1,
205
+ kind: 'error',
206
+ action: 'update',
207
+ error: {
208
+ code: 'service_manager_operation_failed',
209
+ message: 'The active Runtime Host operator predates capability reporting and cannot be safely retired; uninstall it before updating',
210
+ },
211
+ });
212
+ return 1;
213
+ }
186
214
  }
187
215
  emit(progress('staging', currentVersion, options.version));
188
216
  deployment = await deps.withLifecycleLock(options.clientDataRoot, () => targetDeploymentIsCurrent
@@ -212,11 +240,6 @@ export async function runManagedRuntimeHostUpdateCli(options, overrides = {}, fr
212
240
  }
213
241
  if (status.service.active) {
214
242
  emit(progress('retiring', currentVersion, options.version));
215
- const runCurrentOperator = (args) => currentOperatorUsesProcessLifetimeLock
216
- ? deps.runOperator(currentOperator, args)
217
- : deps.withLegacyOperatorLeases(options.clientDataRoot, (inheritedFds) => deps.runOperator(currentOperator, args, {
218
- inheritedFds,
219
- }));
220
243
  let retirement = currentOperatorUnavailable
221
244
  ? {
222
245
  schemaVersion: 1,
@@ -227,7 +250,7 @@ export async function runManagedRuntimeHostUpdateCli(options, overrides = {}, fr
227
250
  message: 'The active Runtime Host operator is unavailable',
228
251
  },
229
252
  }
230
- : await runCurrentOperator([
253
+ : await deps.runOperator(currentOperator, [
231
254
  'retire',
232
255
  '--framed',
233
256
  ...expectedTargetArgs(options.expectedTarget),
@@ -772,16 +795,6 @@ function activeTasksRetirementFrame(status) {
772
795
  retirement: { kind: 'active_tasks' },
773
796
  };
774
797
  }
775
- function operatorUsesProcessLifetimeLock(frame) {
776
- if (frame.kind === 'error') {
777
- throw new RuntimeHostServiceManagerError('service_manager_operation_failed', `The current Runtime Host operator could not report its lock protocol: ${frame.error.message}`);
778
- }
779
- if (frame.action !== 'status') {
780
- throw new Error('The current Runtime Host operator returned an invalid capability result');
781
- }
782
- return (frame.operatorCapabilities?.includes(RUNTIME_HOST_OPERATOR_PROCESS_LIFETIME_LOCK_CAPABILITY) ===
783
- true);
784
- }
785
798
  function operatorCapabilities() {
786
799
  return process.env[RUNTIME_HOST_OPERATOR_CAPABILITY_REQUEST_ENV] ===
787
800
  RUNTIME_HOST_OPERATOR_ACCESS_MANAGEMENT_CAPABILITY
@@ -790,21 +803,20 @@ function operatorCapabilities() {
790
803
  }
791
804
  : {};
792
805
  }
793
- async function runManagedRuntimeHostOperator(operator, args, invocation = {}) {
806
+ async function runManagedRuntimeHostOperator(operator, args, invocation) {
794
807
  return new Promise((resolve, reject) => {
795
- const inheritedFds = invocation.inheritedFds ?? [];
796
808
  const command = runtimeHostOperatorInvocation(operator, args);
797
809
  const child = spawn(command.executable, [...command.args], {
798
- // A detached legacy operator keeps the inherited advisory leases alive if
799
- // this updater is interrupted, so an exact retry never steals active work.
810
+ // A detached operator can finish a retirement already in progress even
811
+ // if this updater exits, so an exact retry never steals active work.
800
812
  detached: process.platform !== 'win32',
801
- env: invocation.capabilityRequest
813
+ env: invocation?.capabilityRequest
802
814
  ? {
803
815
  ...process.env,
804
816
  [RUNTIME_HOST_OPERATOR_CAPABILITY_REQUEST_ENV]: invocation.capabilityRequest,
805
817
  }
806
818
  : process.env,
807
- stdio: ['ignore', 'pipe', 'pipe', ...inheritedFds],
819
+ stdio: ['ignore', 'pipe', 'pipe'],
808
820
  windowsHide: true,
809
821
  });
810
822
  if (!child.stdout || !child.stderr) {
@@ -85,6 +85,7 @@ const ARTIFACT_SOURCE_POLICIES = {
85
85
  tool_result_projection: { userDeletable: false, userVisible: false, sharedReadable: true },
86
86
  tool_result_archive: { userDeletable: false, userVisible: false, sharedReadable: false },
87
87
  subagent_writeback: { userDeletable: false, userVisible: true, sharedReadable: false },
88
+ // Kept so reports saved before Deep Research retirement remain readable.
88
89
  deep_research: { userDeletable: false, userVisible: true, sharedReadable: false },
89
90
  user_upload: { userDeletable: true, userVisible: false, sharedReadable: true },
90
91
  session_effect: { userDeletable: false, userVisible: false, sharedReadable: false },
@@ -413,9 +413,8 @@ function buildStaticModelMetadata(active) {
413
413
  return {
414
414
  anthropic: ANTHROPIC_MODEL_OVERRIDES,
415
415
  'claude-subscription': claudeSubscriptionModelMetadata(active),
416
- // Both Command Code providers ride the same Provider-API effort table.
416
+ // The Command Code Provider-API plan rides the same effort table.
417
417
  commandcode: COMMAND_CODE_MODEL_METADATA,
418
- 'commandcode-go': COMMAND_CODE_MODEL_METADATA,
419
418
  'alibaba-token-plan-cn': {
420
419
  'qwen3.8-max': {
421
420
  thinkingOptions: { efforts: ['none', 'low', 'medium', 'xhigh'], toggle: true },
@@ -22,12 +22,7 @@ import { providerAuthRequiresSecret, providerDefaultsOf, providerSupportsModelDi
22
22
  * storage coordinator actually gates — an operation with no admission point
23
23
  * does not belong here, however natural it sounds beside these three.
24
24
  */
25
- export const PROVIDER_AUTH_ACTIONS = [
26
- 'test_credentials',
27
- 'fetch_models',
28
- 'read_usage',
29
- 'start_oauth',
30
- ];
25
+ export const PROVIDER_AUTH_ACTIONS = ['test_credentials', 'fetch_models', 'start_oauth'];
31
26
  /**
32
27
  * Which credential operations a connection may run. This is an admission
33
28
  * answer, not a UI state: the storage layer refuses an unavailable action, so a
@@ -74,7 +69,6 @@ export function deriveProviderAuthContract(input) {
74
69
  fetch_models: canFetchModels && (reachableWithoutSecret || hasSecret),
75
70
  // Reading account usage needs the same reachability as a connection test:
76
71
  // a credential the provider accepts over HTTP.
77
- read_usage: reachableWithoutSecret || hasSecret,
78
72
  }),
79
73
  };
80
74
  }
@@ -1220,20 +1220,26 @@ const providerRegistry = {
1220
1220
  signupUrl: 'https://commandcode.ai/docs/plans/goat',
1221
1221
  catalogOrder: 41.5,
1222
1222
  },
1223
+ // Retired rather than removed: an existing connection must stay identifiable
1224
+ // and must answer `provider_retired` at readiness. Removing the entry would
1225
+ // leave it *unknown*, which `isConnectionReady` does not reject, so a send
1226
+ // would be admitted and only fail deep in model construction. Its transport
1227
+ // presented the official CLI's identity to a private endpoint, which is why
1228
+ // nothing can send through it any more.
1223
1229
  'commandcode-go': {
1224
1230
  label: 'Command Code GO',
1225
- // The API root, not `/provider/v1`: generation posts to `/alpha/generate`
1226
- // and discovery reads `/provider/v1/models`, both under it.
1227
1231
  baseUrl: 'https://api.commandcode.ai',
1228
1232
  authKind: 'api_key',
1229
1233
  fallbackModels: [],
1230
- status: 'ready',
1231
- runtimeAdapter: { kind: 'commandcode-cli' },
1232
- modelDiscovery: { kind: 'protocol', path: 'provider/v1/models' },
1234
+ status: 'phase3-experimental',
1235
+ runtimeAdapter: { kind: 'unavailable' },
1236
+ retired: true,
1237
+ modelDiscovery: {
1238
+ kind: 'fallback',
1239
+ reason: 'The GO plan was reached through the official CLI\u2019s private transport.',
1240
+ },
1233
1241
  category: 'overseas',
1234
1242
  catalogGroup: 'plans',
1235
- signupUrl: 'https://commandcode.ai/docs/plans/go',
1236
- catalogOrder: 41.6,
1237
1243
  },
1238
1244
  'cloudflare-workers-ai': {
1239
1245
  label: cloudflareWorkersAi.name,
@@ -59,7 +59,7 @@ import { validateWorkspacePrivacyContext } from './incognito.js';
59
59
  import { redactSecrets } from './redaction.js';
60
60
  import { SEARCH_QUERY_MAX_CHARS } from './search.js';
61
61
  import { collapseSessionRevisions } from './session-revisions.js';
62
- import { foldForMatch, MAX_SESSIONS_SCANNED, threadSearchMatchKind } from './thread-search.js';
62
+ import { foldForMatch, MAX_SESSIONS_SCANNED, threadSearchMatchKind } from './transcript-search.js';
63
63
  /** Okapi BM25 term-frequency saturation, Lucene's default. */
64
64
  export const RECALL_BM25_K1 = 1.2;
65
65
  /** Okapi BM25 length normalization, Lucene's default. */
@@ -960,6 +960,10 @@ function buildPassage(anchor, transcript, session, budget, activeSessionId, span
960
960
  sessionTitle: redactSecrets(session?.name ?? ''),
961
961
  ...(anchor.turnId ? { turnId: anchor.turnId } : {}),
962
962
  anchorMessageId: anchor.message.id,
963
+ // The anchor's position in the transcript this passage was built from.
964
+ // `anchorIndex` is already `findIndex` over that exact array, so this is
965
+ // the same coordinate the transcript reader addresses.
966
+ sequence: anchorIndex,
963
967
  messages,
964
968
  matchedTerms: anchor.matchedTerms,
965
969
  score: Number(anchor.score.toFixed(4)),
@@ -17,11 +17,6 @@
17
17
  * under the License.
18
18
  */
19
19
  export const SESSION_START_MODE_SPECS = {
20
- deep_research: {
21
- name: 'Deep Research',
22
- labels: ['mode:deep_research'],
23
- permissionMode: 'explore',
24
- },
25
20
  bot: {
26
21
  labels: ['mode:bot'],
27
22
  permissionMode: 'explore',
@@ -29,6 +24,8 @@ export const SESSION_START_MODE_SPECS = {
29
24
  };
30
25
  export const SESSION_START_MODES = Object.keys(SESSION_START_MODE_SPECS);
31
26
  export const SESSION_START_MODE_LABELS = [
27
+ // Historical mode labels remain reserved when editing old Sessions.
28
+ 'mode:deep_research',
32
29
  ...new Set(Object.values(SESSION_START_MODE_SPECS).flatMap((spec) => spec.labels)),
33
30
  ];
34
31
  export function isSessionStartMode(value) {
@@ -27,7 +27,6 @@ import { isTokenUsageFields } from './usage-record-schema.js';
27
27
  import { decodeCanonicalToolResultContent, decodePersistedToolResultContent, } from './tool-result-record-schema.js';
28
28
  import { markPersisted } from './persisted-value.js';
29
29
  import { decodeTurnOrigin } from './turn-origin.js';
30
- export { DEEP_RESEARCH_SESSION_LABEL, isDeepResearchSession } from './deep-research.js';
31
30
  /** Runtime execution states. Archive visibility is represented by `isArchived`. */
32
31
  export const SESSION_STATUSES = [
33
32
  'active',
@@ -27,6 +27,23 @@ import { normalizeSubagentSettings } from './subagent-settings.js';
27
27
  import { isPetPackId } from './pet.js';
28
28
  export { UI_LOCALE_PREFERENCES, isUiLocalePreference } from './ui-locale.js';
29
29
  export { BOT_DELIVERY_PROVIDERS, BOT_PROVIDERS, BOT_READINESS_STATES, MAX_ALLOWED_USER_IDS, createDefaultBotChannel, hasBotChannelCredentials, isBotDeliveryProvider, isBotReadinessState, normalizeAllowedUserIds, parseAllowedUserIdsFromText, } from './bot-chat-settings.js';
30
+ export const USAGE_SCREEN_SEARCH_MAX_BYTES = 1024;
31
+ const USAGE_SCREEN_UTF8 = new TextEncoder();
32
+ /** Shared domain for the Usage screen's free-text query at every boundary. */
33
+ export function isUsageScreenSearch(value) {
34
+ return (typeof value === 'string' &&
35
+ USAGE_SCREEN_UTF8.encode(value).byteLength <= USAGE_SCREEN_SEARCH_MAX_BYTES);
36
+ }
37
+ /**
38
+ * Persisted Usage timestamps may retain sub-millisecond precision. Keep them
39
+ * JSON/SQLite round-trip safe so a stored value can also name a continuation.
40
+ */
41
+ export function isUsageTimestamp(value) {
42
+ return (typeof value === 'number' &&
43
+ Number.isFinite(value) &&
44
+ value >= 0 &&
45
+ value <= Number.MAX_SAFE_INTEGER);
46
+ }
30
47
  export const SETTINGS_SECTIONS = [
31
48
  'general',
32
49
  'appearance',
@@ -217,13 +217,6 @@ export function formatToolInvocationLine(item, locale) {
217
217
  parts.push(`${cols}x${rows}`);
218
218
  return parts.join(' · ');
219
219
  }
220
- if (name === 'deep_research_start') {
221
- const objective = stringField(args, 'objective');
222
- if (objective) {
223
- const scopeLevel = stringField(args, 'scope_level');
224
- return redactSecrets(scopeLevel ? `${objective} (${scopeLevel})` : objective);
225
- }
226
- }
227
220
  if (name === 'GoalSet') {
228
221
  const condition = stringField(args, 'condition');
229
222
  if (condition)
@@ -304,10 +297,6 @@ const ARGS_PREVIEW_SCALAR_KEYS = [
304
297
  'id',
305
298
  'ref',
306
299
  ];
307
- // This tool's objective is the compact row's durable headline. Keep it
308
- // explicit rather than widening the generic wire allowlist with a broad key
309
- // such as `input`: non-WriteStdin tools otherwise retain arbitrary payloads.
310
- const DEEP_RESEARCH_START_PREVIEW_SCALAR_KEYS = ['objective', 'scope_level'];
311
300
  const ARGS_PREVIEW_NUMBER_KEYS = ['offset', 'limit'];
312
301
  function boundPreviewString(value) {
313
302
  const redacted = redactSecrets(value);
@@ -387,11 +376,8 @@ export function projectToolArgsPreview(toolName, args) {
387
376
  // Apply the canonical activity projection first so WriteStdin's inputPreview
388
377
  // shape (bounded, display-safe) is what the whitelist picks up.
389
378
  const projected = asRecord(projectToolActivityArgs(toolName, args)) ?? record;
390
- const scalarKeys = toolName === 'deep_research_start'
391
- ? [...ARGS_PREVIEW_SCALAR_KEYS, ...DEEP_RESEARCH_START_PREVIEW_SCALAR_KEYS]
392
- : ARGS_PREVIEW_SCALAR_KEYS;
393
379
  const picked = new Map();
394
- for (const key of scalarKeys) {
380
+ for (const key of ARGS_PREVIEW_SCALAR_KEYS) {
395
381
  if (isSensitiveKey(key))
396
382
  continue;
397
383
  const value = previewStringField(projected, key);
@@ -429,7 +415,7 @@ export function projectToolArgsPreview(toolName, args) {
429
415
  // Enforce the whole-preview budget by dropping lowest-priority fields; the
430
416
  // first picked (highest-priority) field always survives.
431
417
  const keysByPriority = [
432
- ...scalarKeys,
418
+ ...ARGS_PREVIEW_SCALAR_KEYS,
433
419
  ...ARGS_PREVIEW_NUMBER_KEYS,
434
420
  'inputPreview',
435
421
  'size',
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ /** Max sessions scanned per query (newest first by lastMessageAt). */
20
+ export const MAX_SESSIONS_SCANNED = 200;
21
+ /**
22
+ * NFC + lowercase canonicalization for substring match. NOT a security
23
+ * boundary — purely for case-insensitive + composed-form matching.
24
+ */
25
+ export function foldForMatch(value) {
26
+ return value.normalize('NFC').toLowerCase();
27
+ }
28
+ /** Stable result classification shared by Desktop navigation and Agent tools. */
29
+ export function threadSearchMatchKind(message) {
30
+ switch (message.type) {
31
+ case 'user':
32
+ return 'user_message';
33
+ case 'assistant':
34
+ return 'assistant_message';
35
+ case 'tool_call':
36
+ return 'tool_intent';
37
+ case 'tool_result':
38
+ return 'tool_result';
39
+ case 'permission_decision':
40
+ case 'token_usage':
41
+ case 'turn_state':
42
+ case 'workhub_coordination':
43
+ case 'system_note':
44
+ throw new Error(`Message type ${message.type} is not searchable`);
45
+ }
46
+ }
@@ -82,11 +82,8 @@
82
82
  "./agent-graph-supervisor-wake": "./dist/agent-graph-supervisor-wake.js",
83
83
  "./session-todo": "./dist/session-todo.js",
84
84
  "./external-session": "./dist/external-session.js",
85
- "./deep-research-run": "./dist/deep-research-run.js",
86
- "./deep-research-client-progress": "./dist/deep-research-client-progress.js",
87
85
  "./daily-review": "./dist/daily-review.js",
88
86
  "./work-board": "./dist/work-board.js",
89
- "./deep-research": "./dist/deep-research.js",
90
87
  "./session-start-mode": "./dist/session-start-mode.js",
91
88
  "./long-term-memory": "./dist/long-term-memory.js",
92
89
  "./local-memory": "./dist/local-memory.js",
@@ -128,7 +125,7 @@
128
125
  "./session-send-projection": "./dist/session-send-projection.js",
129
126
  "./session-name": "./dist/session-name.js",
130
127
  "./recall": "./dist/recall.js",
131
- "./thread-search": "./dist/thread-search.js",
128
+ "./transcript-search": "./dist/transcript-search.js",
132
129
  "./agent-graph-timeline": "./dist/agent-graph-timeline.js",
133
130
  "./agent-swarm": "./dist/agent-swarm.js",
134
131
  "./bot-chat-settings": "./dist/bot-chat-settings.js",
@@ -33,7 +33,6 @@ import { openResponsesUrl } from './provider-urls.js';
33
33
  import { createOpenResponsesCompatibilityFinalizer } from './open-responses-compatibility.js';
34
34
  import { resolveModelRuntime, runtimeProviderName, } from './model-runtime.js';
35
35
  import { openAiCodexHeaders } from './subscription-auth.js';
36
- import { CommandCodeCliLanguageModel } from './commandcode-cli-language-model.js';
37
36
  import { createRequestCustomizationFetch } from './request-customization-fetch.js';
38
37
  import { createStreamUsageFallbackFetch } from './stream-usage-fallback-fetch.js';
39
38
  import { withOpenCodeSessionHeader } from './opencode-session-header.js';
@@ -112,13 +111,6 @@ export function getAIModel(input) {
112
111
  }).chat(modelId);
113
112
  case 'cohere':
114
113
  return createCohere({ apiKey, baseURL, fetch: requestFetch })(modelId);
115
- case 'commandcode-cli':
116
- return new CommandCodeCliLanguageModel({
117
- modelId,
118
- apiKey,
119
- apiBase: baseURL,
120
- fetch: requestFetch,
121
- });
122
114
  case 'openai-compatible': {
123
115
  if (adapter.requireBaseUrl && !baseURL) {
124
116
  throw new Error(`${connection.providerType} connection ${connection.slug} requires a base URL`);
@@ -653,14 +645,6 @@ function buildFamilyWire(connection, modelId, level, thinkingOptions, requestedL
653
645
  ? { thinking: { type: 'disabled' } }
654
646
  : {},
655
647
  };
656
- case 'commandcode-cli':
657
- // The CLI wire takes `reasoning_effort` as the CLI's own effort words.
658
- // `max` is one of them (claude-fable-5-1, moonshotai/Kimi-K3, …), so the
659
- // chosen level is forwarded verbatim — rounding it down would silently
660
- // send a weaker request than the user asked for.
661
- return level === undefined || level === 'off'
662
- ? {}
663
- : { 'commandcode-cli': { reasoningEffort: level } };
664
648
  default:
665
649
  return {};
666
650
  }
@@ -103,10 +103,7 @@ async function fetchProviderModelsStrict(connection, apiKey, fetchFn) {
103
103
  return filterDiscoveredModels(models, discovery.filter);
104
104
  }
105
105
  case 'openai':
106
- case 'openai-compatible':
107
- // The CLI transport lists models through the Provider API's `/models`,
108
- // which every plan may read.
109
- case 'commandcode-cli': {
106
+ case 'openai-compatible': {
110
107
  const r = await fetchForConnectionEffect(fetchFn, modelListUrl(baseUrl, discovery.path, discovery.query), {
111
108
  headers: {
112
109
  'content-type': 'application/json',
@@ -114,14 +114,6 @@ function adapterCalls(adapter) {
114
114
  return [{ adapter, wire: 'google-generate', reasoningReplay: { kind: 'none' } }];
115
115
  case 'cohere':
116
116
  return [{ adapter, wire: 'cohere-v2', reasoningReplay: { kind: 'none' } }];
117
- case 'commandcode-cli':
118
- return [
119
- {
120
- adapter,
121
- wire: 'commandcode-cli',
122
- reasoningReplay: { kind: 'openai-chat-plaintext', requestField: 'reasoning' },
123
- },
124
- ];
125
117
  case 'openai-codex':
126
118
  return [
127
119
  {
@@ -230,6 +230,10 @@ function projectPassage(passage, activeSessionId) {
230
230
  title: passage.sessionTitle,
231
231
  ...(passage.turnId ? { turn_id: passage.turnId } : {}),
232
232
  anchor_message_id: passage.anchorMessageId,
233
+ // The anchor's index in its Session transcript. Carried for the same
234
+ // reason a UI needs it: a caller that wants to point at the passage in a
235
+ // transcript scrolls by sequence, and this spares it a second lookup.
236
+ sequence: passage.sequence,
233
237
  is_current_session: passage.sessionId === activeSessionId,
234
238
  ...(passage.lastMessageAt !== undefined ? { last_message_at: passage.lastMessageAt } : {}),
235
239
  matched_terms: passage.matchedTerms,
@@ -25,7 +25,6 @@ import { isCanonicalReadOnlyPermissionProfile } from '@maka/core/permission-prof
25
25
  import { DEFAULT_TOOL_MODE } from '@maka/core/tool-mode';
26
26
  import { PLAN_USER_ABANDON_REASON, PLAN_USER_CANCEL_REASON, PlanConflictError, activePlanExecution, } from '@maka/core/plan';
27
27
  import { DEFAULT_SESSION_NAME } from '@maka/core/session-name';
28
- import { DEEP_RESEARCH_SESSION_LABEL, isDeepResearchSession } from '@maka/core/deep-research';
29
28
  import { SUBAGENT_SESSION_RUNTIME_SCHEMA_VERSION, SUBAGENT_SESSION_SPAWN_SCHEMA_VERSION, childSessionsForParent, subagentSessionRuntimeSummary, } from '@maka/core/session';
30
29
  import { decodeAgentGraphIntentClaim } from '@maka/core/agent-graph-control';
31
30
  import { executionBoundaryContains } from '@maka/core/sandbox-boundary';
@@ -347,11 +346,7 @@ export class SessionManager {
347
346
  throw new SessionConfigurationTransitionError('session_busy', 'Session has a pending Interaction');
348
347
  }
349
348
  await this.assertCollaborationTransition(current.header, input.configuration.collaborationMode);
350
- const leavingDeepResearch = isDeepResearchSession(current.header.labels) &&
351
- input.configuration.permissionMode !== 'explore';
352
- const labels = leavingDeepResearch
353
- ? current.header.labels.filter((label) => label !== DEEP_RESEARCH_SESSION_LABEL)
354
- : current.header.labels;
349
+ const labels = current.header.labels;
355
350
  return () => store.updateSessionConfiguration(sessionId, {
356
351
  expectedVersion: input.expectedRevision,
357
352
  configuration: {
@@ -705,15 +700,11 @@ export class SessionManager {
705
700
  async setPermissionModeWithLegacyStore(sessionId, mode) {
706
701
  const previous = await this.deps.store.readHeader(sessionId);
707
702
  const boundary = await this.deps.store.readExecutionBoundary(sessionId);
708
- const leavingDeepResearch = isDeepResearchSession(previous.labels) && mode !== 'explore';
709
703
  if (previous.permissionMode === mode &&
710
- executionBoundaryMatchesPermissionMode(boundary, mode) &&
711
- !leavingDeepResearch) {
704
+ executionBoundaryMatchesPermissionMode(boundary, mode)) {
712
705
  return headerToSummary(previous);
713
706
  }
714
- const labels = leavingDeepResearch
715
- ? previous.labels.filter((label) => label !== DEEP_RESEARCH_SESSION_LABEL)
716
- : previous.labels;
707
+ const labels = previous.labels;
717
708
  const kind = mode === 'bypass' ? 'bypass' : 'managed';
718
709
  await this.commitExecutionBoundaryTransition(sessionId, boundary, mode, async () => {
719
710
  const current = await this.deps.store.readHeader(sessionId);
@@ -1455,7 +1446,7 @@ export class SessionManager {
1455
1446
  }
1456
1447
  const resolvedPreset = await this.deps.subagentCatalog.resolve(input.subagentId);
1457
1448
  if (resolvedPreset.profile !== input.agentProfile) {
1458
- throw new Error(`Subagent preset "${input.subagentId}" profile changed during spawn`);
1449
+ throw new Error(`Subagent preset "${input.subagentId}" profile changed during spawn. Retry the same agent_spawn call.`);
1459
1450
  }
1460
1451
  return { ...input, resolvedPreset };
1461
1452
  }