maka-agent 0.2.0-dev.24.20260907 → 0.2.0-dev.25.20260908
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -19
- package/README.zh-CN.md +34 -19
- package/dist/pi-transcript-tools.js +6 -0
- package/dist/pi-tui-layout.js +56 -10
- package/dist/pi-tui-pickers.js +102 -1
- package/dist/pi-tui-runner.js +156 -42
- package/dist/pi-tui-todo.js +221 -0
- package/dist/pi-tui-transcript-viewer.js +134 -7
- package/dist/runtime-host-cli-context.js +70 -13
- package/dist/runtime-host-handoff-surface.js +51 -26
- package/dist/runtime-host-local-handoff.js +11 -1
- package/dist/runtime-host-service-manager.js +0 -3
- package/dist/runtime-host-session-channel.js +13 -0
- package/dist/runtime-host-session-driver.js +42 -1
- package/dist/tui-copy-catalog.js +79 -3
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/agent-run.js +1 -0
- package/node_modules/@maka/core/dist/attachments.js +3 -0
- package/node_modules/@maka/core/dist/canonical-json.js +27 -0
- package/node_modules/@maka/core/dist/capabilities.js +35 -0
- package/node_modules/@maka/core/dist/computer-use.js +0 -1
- package/node_modules/@maka/core/dist/display-redaction.js +18 -0
- package/node_modules/@maka/core/dist/llm-connections.js +13 -0
- package/node_modules/@maka/core/dist/model-call-attempt.js +2 -0
- package/node_modules/@maka/core/dist/model-metadata.js +4 -0
- package/node_modules/@maka/core/dist/redaction.js +35 -0
- package/node_modules/@maka/core/dist/run-composition.js +77 -2
- package/node_modules/@maka/core/dist/session.js +30 -4
- package/node_modules/@maka/core/dist/slash-command-catalog.js +1 -0
- package/node_modules/@maka/core/dist/tool-result-record-schema.js +2 -1
- package/node_modules/@maka/core/package.json +1 -0
- package/node_modules/@maka/eval/dist/experiment-directory.js +4 -13
- package/node_modules/@maka/runtime/dist/agent-run-inspect.js +0 -13
- package/node_modules/@maka/runtime/dist/agent-run.js +80 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +16 -8
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +57 -50
- package/node_modules/@maka/runtime/dist/archive-read-tool.js +2 -2
- package/node_modules/@maka/runtime/dist/context-budget-helpers.js +0 -16
- package/node_modules/@maka/runtime/dist/conversation-copy.js +153 -11
- package/node_modules/@maka/runtime/dist/github-copilot-oauth-enrollment.js +3 -3
- package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +69 -1
- package/node_modules/@maka/runtime/dist/mcp-tools.js +7 -2
- package/node_modules/@maka/runtime/dist/model-fetcher.js +42 -2
- package/node_modules/@maka/runtime/dist/model-history.js +0 -112
- package/node_modules/@maka/runtime/dist/plugin-runtime.js +20 -10
- package/node_modules/@maka/runtime/dist/plugin-tool-service.js +205 -0
- package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +8 -1
- package/node_modules/@maka/runtime/dist/request-shape.js +23 -0
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +1 -1
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +4 -0
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +7 -0
- package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +21 -0
- package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +0 -5
- package/node_modules/@maka/runtime/dist/test-connection.js +0 -1
- package/node_modules/@maka/runtime/dist/tool-activation-identity.js +41 -0
- package/node_modules/@maka/runtime/dist/tool-availability.js +11 -1
- package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +63 -1
- package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +42 -12
- package/node_modules/@maka/runtime/dist/tool-result-archive.js +27 -4
- package/node_modules/@maka/runtime/package.json +1 -0
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +35 -12
- package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +2 -0
- package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +19 -0
- package/node_modules/@maka/runtime-host/dist/control/endpoint.js +1 -3
- package/node_modules/@maka/runtime-host/dist/node-error.js +22 -0
- package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +1 -3
- package/node_modules/@maka/runtime-host/dist/peer-mesh/limits.js +0 -1
- package/node_modules/@maka/runtime-host/dist/peer-mesh/model.js +1 -1
- package/node_modules/@maka/runtime-host/dist/peer-reachability/publisher.js +1 -3
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +5 -1
- package/node_modules/@maka/runtime-host/dist/protocol/plan.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +27 -5
- package/node_modules/@maka/runtime-host/dist/protocol/project-catalog.js +2 -2
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +31 -2
- package/node_modules/@maka/runtime-host/dist/server/agent-graph-coordinator.js +0 -3
- package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +32 -32
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +44 -9
- package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +42 -14
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +47 -22
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +5 -2
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +20 -2
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +13 -3
- package/node_modules/@maka/runtime-host/dist/server/workhub-message-attachments.js +46 -0
- package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +0 -1
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +284 -196
- package/node_modules/@maka/storage/dist/git-exec.js +61 -0
- package/node_modules/@maka/storage/dist/git-worktree-child-executor.js +8 -35
- package/node_modules/@maka/storage/dist/goal-authority.js +2 -2
- package/node_modules/@maka/storage/dist/interaction-store.js +2 -2
- package/node_modules/@maka/storage/dist/project-catalog.js +2 -23
- package/node_modules/@maka/storage/dist/runtime-event-invariants.js +2 -2
- package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +8 -3
- package/node_modules/@maka/storage/dist/scheduled-task-store.js +249 -283
- package/node_modules/@maka/storage/dist/session-bundle-manifest.js +5 -17
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +2 -1
- package/node_modules/@maka/storage/dist/session-copy-cleanup.js +2 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +1 -2
- package/node_modules/@maka/storage/dist/storage-id.js +28 -0
- package/node_modules/@maka/storage/dist/tool-result-archive-evidence.js +31 -4
- package/node_modules/@maka/storage/dist/workspace-identity.js +2 -15
- package/node_modules/@maka/storage/dist/workspace-version-authority-internal.js +1 -8
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
import { execFile } from 'node:child_process';
|
|
20
|
+
import { promisify } from 'node:util';
|
|
21
|
+
const execFileAsync = promisify(execFile);
|
|
22
|
+
const DEFAULT_TIMEOUT_MS = 2 * 60 * 1_000;
|
|
23
|
+
const DEFAULT_TEXT_MAX_BUFFER = 1024 * 1024;
|
|
24
|
+
const DEFAULT_BYTES_MAX_BUFFER = Number.MAX_SAFE_INTEGER;
|
|
25
|
+
/**
|
|
26
|
+
* Runs Git with repository discovery isolated from ambient Git environment
|
|
27
|
+
* variables. Callers may provide a temporary index for patch construction.
|
|
28
|
+
*/
|
|
29
|
+
export async function execGitText(cwd, args, options = {}) {
|
|
30
|
+
const { stdout } = await execFileAsync('git', ['-C', cwd, ...args], {
|
|
31
|
+
env: gitEnvironment(options),
|
|
32
|
+
encoding: 'utf8',
|
|
33
|
+
maxBuffer: options.maxBuffer ?? DEFAULT_TEXT_MAX_BUFFER,
|
|
34
|
+
timeout: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
35
|
+
windowsHide: true,
|
|
36
|
+
});
|
|
37
|
+
return stdout;
|
|
38
|
+
}
|
|
39
|
+
export async function execGitBytes(cwd, args, options = {}) {
|
|
40
|
+
const { stdout } = await execFileAsync('git', ['-C', cwd, ...args], {
|
|
41
|
+
env: gitEnvironment(options),
|
|
42
|
+
encoding: 'buffer',
|
|
43
|
+
maxBuffer: options.maxBuffer ?? DEFAULT_BYTES_MAX_BUFFER,
|
|
44
|
+
timeout: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
45
|
+
windowsHide: true,
|
|
46
|
+
});
|
|
47
|
+
return new Uint8Array(stdout);
|
|
48
|
+
}
|
|
49
|
+
function gitEnvironment(options) {
|
|
50
|
+
const env = { ...process.env, GIT_OPTIONAL_LOCKS: '0' };
|
|
51
|
+
delete env.GIT_DIR;
|
|
52
|
+
delete env.GIT_WORK_TREE;
|
|
53
|
+
delete env.GIT_COMMON_DIR;
|
|
54
|
+
if (options.gitIndexFile === undefined) {
|
|
55
|
+
delete env.GIT_INDEX_FILE;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
env.GIT_INDEX_FILE = options.gitIndexFile;
|
|
59
|
+
}
|
|
60
|
+
return env;
|
|
61
|
+
}
|
|
@@ -16,17 +16,14 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { execFile } from 'node:child_process';
|
|
20
19
|
import { copyFile, mkdir, mkdtemp, readdir, realpath, rm, stat } from 'node:fs/promises';
|
|
21
20
|
import { tmpdir } from 'node:os';
|
|
22
21
|
import { isAbsolute, join, normalize, resolve } from 'node:path';
|
|
23
|
-
import { promisify } from 'node:util';
|
|
24
22
|
import { SUBAGENT_WORKSPACE_BINDING_SCHEMA_VERSION, isSubagentWorkspaceBinding, } from '@maka/core/subagent-workspace';
|
|
23
|
+
import { execGitBytes, execGitText } from './git-exec.js';
|
|
25
24
|
import { resolveProjectLocation } from './project-catalog.js';
|
|
26
|
-
const execFileAsync = promisify(execFile);
|
|
27
25
|
const LEASE_PATTERN = /^subagent_worktree_([a-f0-9]{32})$/;
|
|
28
26
|
const WORKTREE_DIRECTORY_PATTERN = /^[a-f0-9]{32}$/;
|
|
29
|
-
const GIT_TIMEOUT_MS = 2 * 60 * 1_000;
|
|
30
27
|
/**
|
|
31
28
|
* Host-owned Git worktree allocator for linked child Sessions.
|
|
32
29
|
*
|
|
@@ -96,8 +93,8 @@ class GitWorktreeChildExecutor {
|
|
|
96
93
|
const currentIndex = (await runGit(binding.worktreePath, ['rev-parse', '--git-path', 'index'])).trim();
|
|
97
94
|
// Preserve staged and committed ignored paths, then overlay all working-tree changes.
|
|
98
95
|
await copyFile(isAbsolute(currentIndex) ? currentIndex : resolve(binding.worktreePath, currentIndex), indexPath);
|
|
99
|
-
const
|
|
100
|
-
await runGit(binding.worktreePath, ['add', '--all', '--'],
|
|
96
|
+
const gitOptions = { gitIndexFile: indexPath };
|
|
97
|
+
await runGit(binding.worktreePath, ['add', '--all', '--'], gitOptions);
|
|
101
98
|
return await runGitBytes(binding.worktreePath, [
|
|
102
99
|
'diff',
|
|
103
100
|
'--cached',
|
|
@@ -108,7 +105,7 @@ class GitWorktreeChildExecutor {
|
|
|
108
105
|
'--no-color',
|
|
109
106
|
binding.baseCommit,
|
|
110
107
|
'--',
|
|
111
|
-
],
|
|
108
|
+
], gitOptions);
|
|
112
109
|
}
|
|
113
110
|
finally {
|
|
114
111
|
await rm(temporary, { recursive: true, force: true });
|
|
@@ -398,35 +395,11 @@ async function gitCurrentBranch(cwd) {
|
|
|
398
395
|
throw error;
|
|
399
396
|
}
|
|
400
397
|
}
|
|
401
|
-
async function runGit(cwd, args,
|
|
402
|
-
|
|
403
|
-
const { stdout } = await execFileAsync('git', ['-C', cwd, ...args], {
|
|
404
|
-
env,
|
|
405
|
-
encoding: 'utf8',
|
|
406
|
-
maxBuffer: 1024 * 1024,
|
|
407
|
-
timeout: GIT_TIMEOUT_MS,
|
|
408
|
-
windowsHide: true,
|
|
409
|
-
});
|
|
410
|
-
return stdout;
|
|
398
|
+
async function runGit(cwd, args, options = {}) {
|
|
399
|
+
return execGitText(cwd, args, options);
|
|
411
400
|
}
|
|
412
|
-
async function runGitBytes(cwd, args,
|
|
413
|
-
|
|
414
|
-
env: gitEnvironment(overrides),
|
|
415
|
-
encoding: 'buffer',
|
|
416
|
-
maxBuffer: Number.MAX_SAFE_INTEGER,
|
|
417
|
-
timeout: GIT_TIMEOUT_MS,
|
|
418
|
-
windowsHide: true,
|
|
419
|
-
});
|
|
420
|
-
return new Uint8Array(stdout);
|
|
421
|
-
}
|
|
422
|
-
function gitEnvironment(overrides) {
|
|
423
|
-
const env = { ...process.env, GIT_OPTIONAL_LOCKS: '0', ...overrides };
|
|
424
|
-
delete env.GIT_DIR;
|
|
425
|
-
delete env.GIT_WORK_TREE;
|
|
426
|
-
delete env.GIT_COMMON_DIR;
|
|
427
|
-
if (overrides.GIT_INDEX_FILE === undefined)
|
|
428
|
-
delete env.GIT_INDEX_FILE;
|
|
429
|
-
return env;
|
|
401
|
+
async function runGitBytes(cwd, args, options = {}) {
|
|
402
|
+
return execGitBytes(cwd, args, options);
|
|
430
403
|
}
|
|
431
404
|
function gitExitCode(error) {
|
|
432
405
|
if (!error || typeof error !== 'object' || !('code' in error))
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import { decodeGoalAuthorityRecord } from '@maka/core/goal';
|
|
20
20
|
import { acquireOperationalStateDatabase, } from './operational-state-store.js';
|
|
21
21
|
import { assertStorageRootLease, runWithStorageRootLease, StorageRootAuthorityError, } from './root-authority.js';
|
|
22
|
+
import { assertSafeStorageId } from './storage-id.js';
|
|
22
23
|
const writerBrand = Symbol('InteractiveGoalAuthorityWriter');
|
|
23
24
|
const writers = new WeakSet();
|
|
24
25
|
const writerByLease = new WeakMap();
|
|
@@ -217,6 +218,5 @@ function cloneSnapshot(snapshot) {
|
|
|
217
218
|
});
|
|
218
219
|
}
|
|
219
220
|
function requireId(value, label) {
|
|
220
|
-
|
|
221
|
-
throw new TypeError(`${label} identity is invalid`);
|
|
221
|
+
assertSafeStorageId(value, `${label} identity is invalid`);
|
|
222
222
|
}
|
|
@@ -22,7 +22,7 @@ import { clientCapabilityScopeIdentity, decodeClientCapabilitySessionGrant, deco
|
|
|
22
22
|
import { decodeInteractionCanonicalOutcome, decodeInteractionRequest, interactionCanonicalOutcomesEquivalent, isInteractionCanonicalOutcomeValidForRequest, projectInteractionFormRequest, projectInteractionQuestionRequest, } from '@maka/core/interaction';
|
|
23
23
|
import { assertStorageRootLease, runWithStorageRootLease, StorageRootAuthorityError, } from './root-authority.js';
|
|
24
24
|
import { acquireOperationalStateDatabase, } from './operational-state-store.js';
|
|
25
|
-
|
|
25
|
+
import { isSafeStorageId } from './storage-id.js';
|
|
26
26
|
const REMEMBER_SCOPE_ID = /^[0-9a-f]{64}$/;
|
|
27
27
|
export const STORED_INTERACTION_REQUEST_MAX_BYTES = 20 * 1024;
|
|
28
28
|
export const STORED_INTERACTION_OUTCOME_MAX_BYTES = 12 * 1024;
|
|
@@ -512,7 +512,7 @@ function identity(value) {
|
|
|
512
512
|
};
|
|
513
513
|
}
|
|
514
514
|
function assertId(value, source = 'input', message = 'Invalid Interaction identity') {
|
|
515
|
-
if (
|
|
515
|
+
if (!isSafeStorageId(value))
|
|
516
516
|
decodeFailure(source, message);
|
|
517
517
|
return value;
|
|
518
518
|
}
|
|
@@ -16,16 +16,14 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { execFile } from 'node:child_process';
|
|
20
19
|
import { randomUUID } from 'node:crypto';
|
|
21
20
|
import { realpath, stat } from 'node:fs/promises';
|
|
22
21
|
import { basename, dirname, isAbsolute, join, normalize, relative, resolve, sep } from 'node:path';
|
|
23
|
-
import { promisify } from 'node:util';
|
|
24
22
|
import { markPersisted } from '@maka/core/persisted-value';
|
|
23
|
+
import { execGitText } from './git-exec.js';
|
|
25
24
|
import { hasEnclosingGitEntry } from './git-entry.js';
|
|
26
25
|
import { acquireOperationalStateDatabase, } from './operational-state-store.js';
|
|
27
26
|
import { decodePersistedSessionHeader, normalizeSessionHeader } from './session-store.js';
|
|
28
|
-
const execFileAsync = promisify(execFile);
|
|
29
27
|
export class ProjectPathMismatchError extends Error {
|
|
30
28
|
projectId;
|
|
31
29
|
path;
|
|
@@ -690,26 +688,7 @@ function isPathWithin(root, candidate) {
|
|
|
690
688
|
return path === '' || (!isAbsolute(path) && path !== '..' && !path.startsWith(`..${sep}`));
|
|
691
689
|
}
|
|
692
690
|
async function resolveGitLocation(canonicalPath) {
|
|
693
|
-
const
|
|
694
|
-
delete env.GIT_DIR;
|
|
695
|
-
delete env.GIT_WORK_TREE;
|
|
696
|
-
delete env.GIT_INDEX_FILE;
|
|
697
|
-
delete env.GIT_COMMON_DIR;
|
|
698
|
-
const { stdout: locationOutput } = await execFileAsync('git', [
|
|
699
|
-
'-C',
|
|
700
|
-
canonicalPath,
|
|
701
|
-
'rev-parse',
|
|
702
|
-
'--path-format=absolute',
|
|
703
|
-
'--show-toplevel',
|
|
704
|
-
'--git-dir',
|
|
705
|
-
'--git-common-dir',
|
|
706
|
-
], {
|
|
707
|
-
env,
|
|
708
|
-
encoding: 'utf8',
|
|
709
|
-
maxBuffer: 64 * 1024,
|
|
710
|
-
timeout: 3_000,
|
|
711
|
-
windowsHide: true,
|
|
712
|
-
});
|
|
691
|
+
const locationOutput = await execGitText(canonicalPath, ['rev-parse', '--path-format=absolute', '--show-toplevel', '--git-dir', '--git-common-dir'], { maxBuffer: 64 * 1024, timeoutMs: 3_000 });
|
|
713
692
|
const [worktreeRootRaw, gitDirRaw, commonDirRaw] = locationOutput.trim().split(/\r?\n/);
|
|
714
693
|
if (!worktreeRootRaw || !gitDirRaw || !commonDirRaw) {
|
|
715
694
|
throw new Error(`Git returned an incomplete project location for: ${canonicalPath}`);
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
import { isSafeStorageId } from './storage-id.js';
|
|
20
20
|
export function isRuntimeStorageSafeId(value) {
|
|
21
|
-
return
|
|
21
|
+
return isSafeStorageId(value);
|
|
22
22
|
}
|
|
23
23
|
export function immutableSteeringMessageId(event) {
|
|
24
24
|
const messageId = event.refs?.providerEventId;
|
|
@@ -20,7 +20,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
20
20
|
import { isDeepStrictEqual } from 'node:util';
|
|
21
21
|
import { CONNECTION_CATALOG_MAX_CONNECTIONS, decodeCanonicalConnectionCatalogEntry, decodeConnectionName, decodeConnectionSlug, decodeConnectionTarget, decodeConnectionTestSummary, decodeProviderType, decodeRuntimePolicyEntityId, normalizeConnectionCatalogEntryUpdateForProvider, normalizeConnectionModelDiscoveryResult, normalizeCreateCatalogConnectionInput, normalizeRemoveCatalogConnectionInput, normalizeSetDefaultConnectionTargetInput, normalizeUpdateCatalogConnectionInput, } from '@maka/core/runtime-policy';
|
|
22
22
|
import { PROVIDER_REGISTRY, reconcileConnectionAfterModelFetch } from '@maka/core/llm-connections';
|
|
23
|
-
import { modelIdAliasesForProvider } from '@maka/core/model-metadata';
|
|
23
|
+
import { modelIdAliasesForProvider, providerReportsCompleteModelCatalog, } from '@maka/core/model-metadata';
|
|
24
24
|
import { isRetiredProvider } from '@maka/core/provider-registry';
|
|
25
25
|
import { pruneRelayModelProfiles } from '@maka/core/model-thinking';
|
|
26
26
|
import { deepFreeze, nextRevision, record, revision, unique } from './codec.js';
|
|
@@ -325,14 +325,19 @@ export class ConnectionCatalogDocumentOwner {
|
|
|
325
325
|
hasModelInventory: previous.models.length > 0,
|
|
326
326
|
}, result.models, {
|
|
327
327
|
aliases: modelIdAliasesForProvider(previous.providerType),
|
|
328
|
+
authoritative: providerReportsCompleteModelCatalog(previous.providerType),
|
|
328
329
|
});
|
|
329
330
|
// Discovery MOVES a target: a provider's model rename carries the default
|
|
330
331
|
// across by alias. A default outside the selection the reconciler just
|
|
331
332
|
// decided is its own bug — fail closed where it is still attributable.
|
|
332
333
|
const defaultTarget = currentDefaultTarget
|
|
333
|
-
?
|
|
334
|
+
? reconciled.defaultModel
|
|
335
|
+
? { connectionId: previous.connectionId, modelId: reconciled.defaultModel }
|
|
336
|
+
: null
|
|
334
337
|
: current.defaultTarget;
|
|
335
|
-
if (currentDefaultTarget &&
|
|
338
|
+
if (currentDefaultTarget &&
|
|
339
|
+
reconciled.defaultModel &&
|
|
340
|
+
!reconciled.enabledModelIds.includes(reconciled.defaultModel)) {
|
|
336
341
|
throw codecError('invalid_document', 'Model discovery reconciled a default outside its own selection');
|
|
337
342
|
}
|
|
338
343
|
// A refresh only ever migrates a renamed id now, but that rename still
|