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

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 (40) hide show
  1. package/LICENSE +12 -6
  2. package/dist/mcp-capability-provider.js +7 -0
  3. package/dist/runtime-host-tui-command.js +1 -1
  4. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  5. package/node_modules/@maka/core/dist/chat-model-choice.js +3 -0
  6. package/node_modules/@maka/core/dist/llm-connections.js +3 -21
  7. package/node_modules/@maka/core/dist/model-catalog.js +8 -20
  8. package/node_modules/@maka/core/dist/model-metadata.generated.js +304 -304
  9. package/node_modules/@maka/core/dist/model-thinking.js +16 -1
  10. package/node_modules/@maka/core/dist/models-dev-projection.js +0 -1
  11. package/node_modules/@maka/core/dist/provider-registry.js +7 -51
  12. package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +7 -0
  13. package/node_modules/@maka/core/dist/runtime-policy/model-catalog-entry-codec.js +14 -1
  14. package/node_modules/@maka/core/dist/settings.js +2 -3
  15. package/node_modules/@maka/mcp/dist/index.js +22 -0
  16. package/node_modules/@maka/mcp/dist/oauth.js +4 -2
  17. package/node_modules/@maka/mcp/dist/tool-progress.js +45 -0
  18. package/node_modules/@maka/runtime/dist/opencode-session-header.js +2 -3
  19. package/node_modules/@maka/runtime/dist/session-manager.js +1 -44
  20. package/node_modules/@maka/runtime/dist/test-connection.js +3 -66
  21. package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +44 -9
  22. package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
  23. package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +33 -3
  24. package/node_modules/@maka/runtime-host/dist/protocol/index.js +7 -1
  25. package/node_modules/@maka/runtime-host/dist/protocol/message.js +10 -0
  26. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +0 -1
  27. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +1 -1
  28. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +0 -33
  29. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +2 -0
  30. package/node_modules/@maka/runtime-host/dist/server/bootstrap-runtime-policy.js +31 -104
  31. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +0 -2
  32. package/node_modules/@maka/runtime-host/dist/server/interactive-turn-coordinator.js +1 -16
  33. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +46 -28
  34. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +5 -16
  35. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +21 -12
  36. package/node_modules/@maka/runtime-host/dist/server/session-turn-access-request-coordinator.js +7 -17
  37. package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +0 -62
  38. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +0 -3
  39. package/node_modules/@maka/storage/dist/runtime-policy-stores.js +0 -1
  40. package/package.json +1 -1
@@ -21,7 +21,7 @@ import { RuntimeHostProtocolError } from '../protocol/errors.js';
21
21
  import { createHash } from 'node:crypto';
22
22
  import { authorizeConnectionModel, connectionEnabledModelIds } from '@maka/core/llm-connections';
23
23
  import { isModelExplicitlyUnsupportedForChat } from '@maka/core/model-catalog';
24
- import { thinkingVariantsForConnection } from '@maka/core/model-thinking';
24
+ import { defaultThinkingLevelForConnection, thinkingVariantsForConnection, } from '@maka/core/model-thinking';
25
25
  import { executionBoundaryDisplayMode, } from '@maka/core/sandbox-boundary';
26
26
  import { isExecutorId } from '@maka/core/executor-id';
27
27
  import { DEFAULT_SESSION_NAME, normalizeUserSessionName } from '@maka/core/session-name';
@@ -184,7 +184,7 @@ export class HostSessionCatalogCoordinator {
184
184
  */
185
185
  async resolveDefaultCreateTarget() {
186
186
  try {
187
- return await this.#composeCreateTarget(this.#resolveModel({ kind: 'default' }, undefined));
187
+ return await this.#composeCreateTarget(this.#resolveModel({ kind: 'default' }, undefined, true));
188
188
  }
189
189
  catch (error) {
190
190
  if (error instanceof SessionOperationFailure &&
@@ -200,6 +200,7 @@ export class HostSessionCatalogCoordinator {
200
200
  llmConnectionId: model.connectionId,
201
201
  llmConnectionSlug: model.connectionSlug,
202
202
  model: model.model,
203
+ ...(model.thinkingLevel === undefined ? {} : { thinkingLevel: model.thinkingLevel }),
203
204
  permissionMode: policy.policy.chatDefaults.permissionMode,
204
205
  toolMode: policy.policy.chatDefaults.codeModeEnabled ? 'code_mode' : 'direct',
205
206
  collaborationMode: 'agent',
@@ -235,7 +236,7 @@ export class HostSessionCatalogCoordinator {
235
236
  ...(model.connectionId ? { llmConnectionId: model.connectionId } : {}),
236
237
  llmConnectionSlug: model.connectionSlug,
237
238
  model: model.model,
238
- ...(input.thinkingLevel === undefined ? {} : { thinkingLevel: input.thinkingLevel }),
239
+ ...(model.thinkingLevel === undefined ? {} : { thinkingLevel: model.thinkingLevel }),
239
240
  ...(input.toolProfile === undefined ? {} : { toolProfile: input.toolProfile }),
240
241
  permissionMode: prepared.permissionMode ?? policy.policy.chatDefaults.permissionMode,
241
242
  toolMode: policy.policy.chatDefaults.codeModeEnabled ? 'code_mode' : 'direct',
@@ -405,7 +406,7 @@ export class HostSessionCatalogCoordinator {
405
406
  ...(model.connectionId ? { llmConnectionId: model.connectionId } : {}),
406
407
  llmConnectionSlug: model.connectionSlug,
407
408
  model: model.model,
408
- ...(input.thinkingLevel === undefined ? {} : { thinkingLevel: input.thinkingLevel }),
409
+ ...(model.thinkingLevel === undefined ? {} : { thinkingLevel: model.thinkingLevel }),
409
410
  ...(input.toolProfile === undefined ? {} : { toolProfile: input.toolProfile }),
410
411
  permissionMode: prepared.permissionMode ?? policy.policy.chatDefaults.permissionMode,
411
412
  toolMode: toolMode ?? (policy.policy.chatDefaults.codeModeEnabled ? 'code_mode' : 'direct'),
@@ -715,7 +716,7 @@ export class HostSessionCatalogCoordinator {
715
716
  connectionId: candidate.connectionId,
716
717
  connectionSlug: candidate.connectionSlug,
717
718
  model: candidate.modelId,
718
- }, undefined);
719
+ }, undefined, true);
719
720
  }
720
721
  catch (error) {
721
722
  if (!(error instanceof SessionOperationFailure))
@@ -741,7 +742,7 @@ export class HostSessionCatalogCoordinator {
741
742
  }
742
743
  throw new NoUsableImportModelError('No usable Session model connection is available for import');
743
744
  }
744
- async #resolveModel(target, thinkingLevel) {
745
+ async #resolveModel(target, thinkingLevel, applyConfiguredDefault = false) {
745
746
  const selected = await this.#selectModelTarget(target);
746
747
  const readiness = await this.#runtimePolicy.operations.resolveExecutionConnection({
747
748
  kind: 'bound',
@@ -788,17 +789,25 @@ export class HostSessionCatalogCoordinator {
788
789
  // rejected — execution-model-authority rebuilds the runtime connection
789
790
  // from the same table, so whatever passes here is exactly what the wire
790
791
  // can send.
791
- if (thinkingLevel !== undefined &&
792
+ const resolvedThinkingLevel = thinkingLevel ??
793
+ (applyConfiguredDefault
794
+ ? defaultThinkingLevelForConnection({
795
+ providerType: connection.providerType,
796
+ modelOverrides: connection.modelOverrides,
797
+ }, selected.modelId)
798
+ : undefined);
799
+ if (resolvedThinkingLevel !== undefined &&
792
800
  !thinkingVariantsForConnection({
793
801
  providerType: connection.providerType,
794
802
  modelOverrides: connection.modelOverrides,
795
- }, selected.modelId).includes(thinkingLevel)) {
796
- throw new SessionOperationFailure('invalid_request', `Session model does not support thinking level ${thinkingLevel}`);
803
+ }, selected.modelId).includes(resolvedThinkingLevel)) {
804
+ throw new SessionOperationFailure('invalid_request', `Session model does not support thinking level ${resolvedThinkingLevel}`);
797
805
  }
798
806
  return {
799
807
  connectionId: connection.connectionId,
800
808
  connectionSlug: connection.slug,
801
809
  model: selected.modelId,
810
+ thinkingLevel: resolvedThinkingLevel,
802
811
  };
803
812
  }
804
813
  async #selectModelTarget(target) {
@@ -888,7 +897,7 @@ export class HostSessionCatalogCoordinator {
888
897
  if (!input.modelTarget) {
889
898
  throw new SessionOperationFailure('invalid_request', 'Session creation requires a model target or executor id');
890
899
  }
891
- return await this.#resolveModel(input.modelTarget, input.thinkingLevel);
900
+ return await this.#resolveModel(input.modelTarget, input.thinkingLevel ?? undefined, input.thinkingLevel !== null);
892
901
  }
893
902
  async #readRuntimePolicy() {
894
903
  try {
@@ -943,7 +952,7 @@ async function prepareCreate(input) {
943
952
  }
944
953
  function createRequestFingerprint(input, prepared) {
945
954
  const identity = [
946
- 'session.create.v4',
955
+ 'session.create.v5',
947
956
  input.sessionId,
948
957
  input.workspace.kind === 'project'
949
958
  ? ['project', input.workspace.projectId]
@@ -960,7 +969,7 @@ function createRequestFingerprint(input, prepared) {
960
969
  input.modelTarget.connectionSlug,
961
970
  input.modelTarget.model,
962
971
  ],
963
- input.thinkingLevel ?? null,
972
+ input.thinkingLevel === undefined ? ['model_default'] : input.thinkingLevel,
964
973
  input.toolProfile ?? null,
965
974
  prepared.permissionMode ?? ['runtime_default'],
966
975
  input.collaborationMode ?? 'agent',
@@ -19,7 +19,6 @@
19
19
  export class SessionTurnAccessRequestCoordinator {
20
20
  #authority;
21
21
  #startTurn;
22
- #regenerateTurn;
23
22
  #acquireResidency;
24
23
  #requestDrain;
25
24
  #whenIdle;
@@ -30,7 +29,6 @@ export class SessionTurnAccessRequestCoordinator {
30
29
  constructor(input) {
31
30
  this.#authority = input.authority;
32
31
  this.#startTurn = input.startTurn;
33
- this.#regenerateTurn = input.regenerateTurn;
34
32
  this.#acquireResidency = input.acquireResidency;
35
33
  this.#requestDrain = input.requestDrain;
36
34
  this.#whenIdle = input.whenIdle;
@@ -98,21 +96,13 @@ export class SessionTurnAccessRequestCoordinator {
98
96
  async #run(request, context) {
99
97
  for (;;) {
100
98
  try {
101
- if ('content' in request.intent) {
102
- const outcome = await this.#startTurn(request.intent, context);
103
- if (outcome.ok)
104
- return outcome.result.kind;
105
- if (outcome.error.code !== 'session_busy') {
106
- return this.#draining ? undefined : 'failed';
107
- }
108
- }
109
- else {
110
- const outcome = await this.#regenerateTurn(request.intent, context);
111
- if (outcome.ok)
112
- return 'started';
113
- if (outcome.error.code !== 'session_busy') {
114
- return this.#draining ? undefined : 'failed';
115
- }
99
+ if (!('content' in request.intent))
100
+ return 'failed';
101
+ const outcome = await this.#startTurn(request.intent, context);
102
+ if (outcome.ok)
103
+ return outcome.result.kind;
104
+ if (outcome.error.code !== 'session_busy') {
105
+ return this.#draining ? undefined : 'failed';
116
106
  }
117
107
  }
118
108
  catch {
@@ -26,7 +26,6 @@ import { CONNECTION_CATALOG_MAX_CONNECTIONS, decodeCanonicalConnectionCatalogEnt
26
26
  import { PROVIDER_REGISTRY, reconcileConnectionAfterModelFetch } from '@maka/core/llm-connections';
27
27
  import { modelIdAliasesForProvider, providerReportsCompleteModelCatalog, } from '@maka/core/model-metadata';
28
28
  import { isRetiredProvider } from '@maka/core/provider-registry';
29
- import { pruneModelOverrides } from '@maka/core/model-thinking';
30
29
  import { deepFreeze, nextRevision, record, revision, unique } from './codec.js';
31
30
  import { codecError, decodeConnectionInput, decodePersistedDomain, RuntimePolicyStoreError, } from './errors.js';
32
31
  import { CATALOG_DOCUMENT_MAX_BYTES, readBoundedJsonDocument, serializeJsonDocument, writeJsonDocument, } from './document-io.js';
@@ -285,67 +284,6 @@ export class ConnectionCatalogDocumentOwner {
285
284
  await this.write(root, next);
286
285
  return committed(next);
287
286
  }
288
- /**
289
- * Built-in seed evolution as ONE atomic catalog mutation. A row whose
290
- * `enabledModelIds` still exactly match a historical system seed is provably
291
- * system-owned: it follows the current seed, its static inventory is
292
- * re-derived from the current build, and a default target the migration
293
- * removes is retargeted inside the same document write — so no restart can
294
- * observe enabled ids without their inventory, or a nulled default awaiting
295
- * a second write. Any other inventory (including a reordering) is a user
296
- * selection and is never touched; an already-null default stays null.
297
- */
298
- async migrateSystemSeed(root, input) {
299
- if (!input.enabledModelIds.includes(input.defaultModelId)) {
300
- throw codecError('invalid_connection_input', 'Seed default must be in the seed selection');
301
- }
302
- const current = await this.read(root);
303
- const index = current.connections.findIndex((item) => item.slug === input.slug && item.providerType === input.providerType);
304
- const previous = current.connections[index];
305
- const retired = new Set(input.retiredModelIds);
306
- const sameIds = (left, right) => left.length === right.length && left.every((id, position) => id === right[position]);
307
- const isLegacySeed = previous
308
- ? input.legacyEnabledModelIds.some((seed) => sameIds(previous.enabledModelIds, seed))
309
- : false;
310
- const hasRetiredModels = previous
311
- ? previous.enabledModelIds.some((id) => retired.has(id)) ||
312
- previous.models.some((model) => retired.has(model.id))
313
- : false;
314
- if (!previous || (!isLegacySeed && !hasRetiredModels)) {
315
- return committed(current);
316
- }
317
- // A legacy seed's stored inventory was the registry's shipped list copied
318
- // in at write time. Clearing it is the migration: the resolver prepends
319
- // that list from the current build, so the row stops carrying a stale
320
- // second copy of it. Any other row keeps its own inventory, minus the
321
- // retired ids.
322
- const models = isLegacySeed ? [] : previous.models.filter((model) => !retired.has(model.id));
323
- const { lastTest: _lastTest, modelSource: _modelSource, modelsFetchedAt: _modelsFetchedAt, ...retained } = previous;
324
- const migratedEnabledModelIds = isLegacySeed
325
- ? [...input.enabledModelIds]
326
- : previous.enabledModelIds.filter((id) => !retired.has(id));
327
- const connections = [...current.connections];
328
- const modelOverrides = pruneModelOverrides(previous.modelOverrides, Object.keys(previous.modelOverrides ?? {}).filter((id) => !retired.has(id)));
329
- connections[index] = {
330
- ...retained,
331
- revision: nextRevision(previous.revision),
332
- enabledModelIds: migratedEnabledModelIds,
333
- models,
334
- ...(isLegacySeed || previous.modelSource === undefined
335
- ? {}
336
- : { modelSource: previous.modelSource, modelsFetchedAt: previous.modelsFetchedAt }),
337
- ...(modelOverrides === undefined ? {} : { modelOverrides }),
338
- };
339
- const target = current.defaultTarget;
340
- const defaultTarget = target !== null &&
341
- target.connectionId === previous.connectionId &&
342
- !migratedEnabledModelIds.includes(target.modelId)
343
- ? { connectionId: previous.connectionId, modelId: input.defaultModelId }
344
- : target;
345
- const next = this.nextDocument(current, connections, defaultTarget);
346
- await this.write(root, next);
347
- return committed(next);
348
- }
349
287
  async setDefaultTarget(root, rawInput) {
350
288
  const input = decodeConnectionInput(() => normalizeSetDefaultConnectionTargetInput(rawInput));
351
289
  const current = await this.read(root);
@@ -195,9 +195,6 @@ export class RuntimePolicyCoordinator {
195
195
  setDefaultTarget(input) {
196
196
  return this.inLane(async (root) => this.projectCatalogMutation(root, await this.catalog.setDefaultTarget(root, input)));
197
197
  }
198
- migrateSystemSeed(input) {
199
- return this.inLane((root) => this.catalog.migrateSystemSeed(root, input));
200
- }
201
198
  setCredential(rawInput) {
202
199
  return this.setCredentialWithAuthority(rawInput, 'client');
203
200
  }
@@ -97,7 +97,6 @@ function createWriterFacade(coordinator) {
97
97
  update: (input) => coordinator.updateConnection(input),
98
98
  remove: (input) => coordinator.removeConnection(input),
99
99
  setDefaultTarget: (input) => coordinator.setDefaultTarget(input),
100
- migrateSystemSeed: (input) => coordinator.migrateSystemSeed(input),
101
100
  },
102
101
  credentialVault: {
103
102
  getSnapshot: () => coordinator.getVaultSnapshot(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maka-agent",
3
- "version": "0.2.0-dev.43.20260919",
3
+ "version": "0.2.0-dev.44.20260920",
4
4
  "description": "Apache Maka (Incubating) developer snapshot; not an Apache release.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",