@ai-matrx/agents 0.59.180 → 0.59.182
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/CHANGELOG.md +3 -3
- package/dist/content-transfer/index.cjs +1 -1
- package/dist/content-transfer/index.js +1 -1
- package/dist/content-transfer/react/index.cjs +1 -1
- package/dist/content-transfer/react/index.js +1 -1
- package/dist/generated/stream-events.d.cts +27 -2
- package/dist/generated/stream-events.d.ts +27 -2
- package/dist/mandates/index.cjs +4 -4
- package/dist/mandates/index.d.cts +6 -6
- package/dist/mandates/index.d.ts +6 -6
- package/dist/mandates/index.js +4 -4
- package/dist/models/index.cjs +23 -0
- package/dist/models/index.d.cts +25 -1
- package/dist/models/index.d.ts +25 -1
- package/dist/models/index.js +23 -0
- package/dist/versions/index.cjs +11 -0
- package/dist/versions/index.d.cts +15 -2
- package/dist/versions/index.d.ts +15 -2
- package/dist/versions/index.js +11 -0
- package/dist/versions/react/index.cjs +159 -95
- package/dist/versions/react/index.js +158 -94
- package/package.json +3 -3
package/dist/models/index.js
CHANGED
|
@@ -1550,6 +1550,28 @@ function resolveSuccessor(modelId, index) {
|
|
|
1550
1550
|
function resetSuccessionLogForTests() {
|
|
1551
1551
|
loggedBroken.clear();
|
|
1552
1552
|
}
|
|
1553
|
+
async function resolveLiveModelId(client, modelId) {
|
|
1554
|
+
const index = /* @__PURE__ */ new Map();
|
|
1555
|
+
let want = modelId;
|
|
1556
|
+
for (let hop = 0; want && hop <= MAX_SUCCESSION_HOPS && !index.has(want); hop += 1) {
|
|
1557
|
+
const { data, error } = await client.schema("ai").from("model_public").select("id, is_deprecated, retired_at, successor_id").in("id", [want]);
|
|
1558
|
+
if (error) {
|
|
1559
|
+
console.warn(`[models/succession] ${modelId}: the catalog could not be read (${error.message}); keeping the model as given.`);
|
|
1560
|
+
return modelId;
|
|
1561
|
+
}
|
|
1562
|
+
const row = Array.isArray(data) ? data[0] : null;
|
|
1563
|
+
if (!row || typeof row.id !== "string") break;
|
|
1564
|
+
const node = {
|
|
1565
|
+
id: row.id,
|
|
1566
|
+
isDeprecated: row.is_deprecated === true,
|
|
1567
|
+
retiredAt: typeof row.retired_at === "string" ? row.retired_at : null,
|
|
1568
|
+
successorId: typeof row.successor_id === "string" ? row.successor_id : null
|
|
1569
|
+
};
|
|
1570
|
+
index.set(node.id, node);
|
|
1571
|
+
want = isSupersedable(node) ? node.successorId : null;
|
|
1572
|
+
}
|
|
1573
|
+
return resolveSuccessor(modelId, index);
|
|
1574
|
+
}
|
|
1553
1575
|
|
|
1554
1576
|
// models/local.ts
|
|
1555
1577
|
import { compareVersions } from "@ai-matrx/kit/versions";
|
|
@@ -2368,6 +2390,7 @@ export {
|
|
|
2368
2390
|
requireCanonicalCapabilities,
|
|
2369
2391
|
requiredArtifacts,
|
|
2370
2392
|
resetSuccessionLogForTests,
|
|
2393
|
+
resolveLiveModelId,
|
|
2371
2394
|
resolvePreferredModelChoice,
|
|
2372
2395
|
resolveSuccessor,
|
|
2373
2396
|
selectActiveModels,
|
package/dist/versions/index.cjs
CHANGED
|
@@ -31,6 +31,8 @@ __export(versions_exports, {
|
|
|
31
31
|
listAgentVersions: () => listAgentVersions,
|
|
32
32
|
promoteAgentVersion: () => promoteAgentVersion,
|
|
33
33
|
promoteFailureMessage: () => promoteFailureMessage,
|
|
34
|
+
promoteSuccessMessage: () => promoteSuccessMessage,
|
|
35
|
+
readAgentCurrentVersion: () => readAgentCurrentVersion,
|
|
34
36
|
readAgentVersionSnapshot: () => readAgentVersionSnapshot,
|
|
35
37
|
resolveAgentVersionId: () => resolveAgentVersionId,
|
|
36
38
|
snapshotToComparable: () => snapshotToComparable
|
|
@@ -130,6 +132,9 @@ function promoteFailureMessage(err) {
|
|
|
130
132
|
const reason = raw.trim();
|
|
131
133
|
return reason ? `${GENERIC}: ${reason}` : GENERIC;
|
|
132
134
|
}
|
|
135
|
+
function promoteSuccessMessage(version) {
|
|
136
|
+
return `v${version}'s settings are now current; no new version was saved`;
|
|
137
|
+
}
|
|
133
138
|
|
|
134
139
|
// versions/enrich.ts
|
|
135
140
|
var import_structural2 = require("@ai-matrx/diff/structural");
|
|
@@ -221,6 +226,12 @@ async function promoteAgentVersion(client, query) {
|
|
|
221
226
|
const result = data ?? {};
|
|
222
227
|
return { ...result, success: result.success === true };
|
|
223
228
|
}
|
|
229
|
+
async function readAgentCurrentVersion(client, agentId) {
|
|
230
|
+
const { data, error } = await client.schema("agent").from("definition").select("version").eq("id", agentId).maybeSingle();
|
|
231
|
+
if (error) throw new AgentVersionsError(error);
|
|
232
|
+
const v = data?.version;
|
|
233
|
+
return typeof v === "number" && Number.isInteger(v) ? v : null;
|
|
234
|
+
}
|
|
224
235
|
async function declareContractBreak(client, query) {
|
|
225
236
|
const { error } = await client.rpc("agx_declare_contract_break", {
|
|
226
237
|
p_agent_id: query.agentId,
|
|
@@ -28,6 +28,13 @@ interface AgentDefinitionComparison {
|
|
|
28
28
|
declare function compareAgentDefinitions(systemAgent: ComparableAgent, personalAgent: ComparableAgent): AgentDefinitionComparison;
|
|
29
29
|
|
|
30
30
|
declare function promoteFailureMessage(err: unknown): string;
|
|
31
|
+
/**
|
|
32
|
+
* The sentence a successful restore shows. `agx_promote_version` copies the version's settings onto
|
|
33
|
+
* the agent and SAVES NO NEW VERSION (it sets `app.skip_version_snapshot`; read 2026-10-21), so the
|
|
34
|
+
* history gains no row: the restored version becomes the current one. Saying so keeps a person from
|
|
35
|
+
* looking for a new row that will never come.
|
|
36
|
+
*/
|
|
37
|
+
declare function promoteSuccessMessage(version: number): string;
|
|
31
38
|
|
|
32
39
|
/** One row of `agx_get_version_history`: a saved version of an agent (newest first). */
|
|
33
40
|
interface AgentVersionHistoryEntry {
|
|
@@ -111,7 +118,7 @@ type Answer = PromiseLike<{
|
|
|
111
118
|
interface VersionsClient {
|
|
112
119
|
rpc(fn: string, args: Record<string, unknown>): Answer;
|
|
113
120
|
schema(name: "agent"): {
|
|
114
|
-
from(table: "definition_version"): {
|
|
121
|
+
from(table: "definition_version" | "definition"): {
|
|
115
122
|
select(columns: string): {
|
|
116
123
|
eq(column: string, value: string): {
|
|
117
124
|
maybeSingle(): Answer;
|
|
@@ -148,6 +155,12 @@ declare function promoteAgentVersion(client: VersionsClient, query: {
|
|
|
148
155
|
agentId: string;
|
|
149
156
|
version: number;
|
|
150
157
|
}): Promise<PromoteVersionResult>;
|
|
158
|
+
/**
|
|
159
|
+
* The version the agent is at NOW (`agent.definition.version`). A restore sets it to the restored
|
|
160
|
+
* number without adding a history row, so the newest history row is not the current version after
|
|
161
|
+
* one: read this instead. Null when the person cannot read the agent.
|
|
162
|
+
*/
|
|
163
|
+
declare function readAgentCurrentVersion(client: VersionsClient, agentId: string): Promise<number | null>;
|
|
151
164
|
/** Declare (or clear, with null) a contract break the hashes cannot see. */
|
|
152
165
|
declare function declareContractBreak(client: VersionsClient, query: {
|
|
153
166
|
agentId: string;
|
|
@@ -155,4 +168,4 @@ declare function declareContractBreak(client: VersionsClient, query: {
|
|
|
155
168
|
kind: ContractBreakKind | null;
|
|
156
169
|
}): Promise<void>;
|
|
157
170
|
|
|
158
|
-
export { AGENT_DIFF_OPTIONS, AGENT_EXCLUDE_PATHS, AGENT_IDENTITY_KEYS, type AgentDefinitionComparison, type AgentVersionHistoryEntry, type AgentVersionLookup, AgentVersionsError, type ComparableAgent, type ContractBreakKind, type EnrichedVersion, type PromoteVersionResult, type VersionHistoryLoad, type VersionsClient, type VersionsDbError, compareAgentDefinitions, computeVersionFetchTargets, declareContractBreak, enrichVersions, listAgentVersions, promoteAgentVersion, promoteFailureMessage, readAgentVersionSnapshot, resolveAgentVersionId, snapshotToComparable };
|
|
171
|
+
export { AGENT_DIFF_OPTIONS, AGENT_EXCLUDE_PATHS, AGENT_IDENTITY_KEYS, type AgentDefinitionComparison, type AgentVersionHistoryEntry, type AgentVersionLookup, AgentVersionsError, type ComparableAgent, type ContractBreakKind, type EnrichedVersion, type PromoteVersionResult, type VersionHistoryLoad, type VersionsClient, type VersionsDbError, compareAgentDefinitions, computeVersionFetchTargets, declareContractBreak, enrichVersions, listAgentVersions, promoteAgentVersion, promoteFailureMessage, promoteSuccessMessage, readAgentCurrentVersion, readAgentVersionSnapshot, resolveAgentVersionId, snapshotToComparable };
|
package/dist/versions/index.d.ts
CHANGED
|
@@ -28,6 +28,13 @@ interface AgentDefinitionComparison {
|
|
|
28
28
|
declare function compareAgentDefinitions(systemAgent: ComparableAgent, personalAgent: ComparableAgent): AgentDefinitionComparison;
|
|
29
29
|
|
|
30
30
|
declare function promoteFailureMessage(err: unknown): string;
|
|
31
|
+
/**
|
|
32
|
+
* The sentence a successful restore shows. `agx_promote_version` copies the version's settings onto
|
|
33
|
+
* the agent and SAVES NO NEW VERSION (it sets `app.skip_version_snapshot`; read 2026-10-21), so the
|
|
34
|
+
* history gains no row: the restored version becomes the current one. Saying so keeps a person from
|
|
35
|
+
* looking for a new row that will never come.
|
|
36
|
+
*/
|
|
37
|
+
declare function promoteSuccessMessage(version: number): string;
|
|
31
38
|
|
|
32
39
|
/** One row of `agx_get_version_history`: a saved version of an agent (newest first). */
|
|
33
40
|
interface AgentVersionHistoryEntry {
|
|
@@ -111,7 +118,7 @@ type Answer = PromiseLike<{
|
|
|
111
118
|
interface VersionsClient {
|
|
112
119
|
rpc(fn: string, args: Record<string, unknown>): Answer;
|
|
113
120
|
schema(name: "agent"): {
|
|
114
|
-
from(table: "definition_version"): {
|
|
121
|
+
from(table: "definition_version" | "definition"): {
|
|
115
122
|
select(columns: string): {
|
|
116
123
|
eq(column: string, value: string): {
|
|
117
124
|
maybeSingle(): Answer;
|
|
@@ -148,6 +155,12 @@ declare function promoteAgentVersion(client: VersionsClient, query: {
|
|
|
148
155
|
agentId: string;
|
|
149
156
|
version: number;
|
|
150
157
|
}): Promise<PromoteVersionResult>;
|
|
158
|
+
/**
|
|
159
|
+
* The version the agent is at NOW (`agent.definition.version`). A restore sets it to the restored
|
|
160
|
+
* number without adding a history row, so the newest history row is not the current version after
|
|
161
|
+
* one: read this instead. Null when the person cannot read the agent.
|
|
162
|
+
*/
|
|
163
|
+
declare function readAgentCurrentVersion(client: VersionsClient, agentId: string): Promise<number | null>;
|
|
151
164
|
/** Declare (or clear, with null) a contract break the hashes cannot see. */
|
|
152
165
|
declare function declareContractBreak(client: VersionsClient, query: {
|
|
153
166
|
agentId: string;
|
|
@@ -155,4 +168,4 @@ declare function declareContractBreak(client: VersionsClient, query: {
|
|
|
155
168
|
kind: ContractBreakKind | null;
|
|
156
169
|
}): Promise<void>;
|
|
157
170
|
|
|
158
|
-
export { AGENT_DIFF_OPTIONS, AGENT_EXCLUDE_PATHS, AGENT_IDENTITY_KEYS, type AgentDefinitionComparison, type AgentVersionHistoryEntry, type AgentVersionLookup, AgentVersionsError, type ComparableAgent, type ContractBreakKind, type EnrichedVersion, type PromoteVersionResult, type VersionHistoryLoad, type VersionsClient, type VersionsDbError, compareAgentDefinitions, computeVersionFetchTargets, declareContractBreak, enrichVersions, listAgentVersions, promoteAgentVersion, promoteFailureMessage, readAgentVersionSnapshot, resolveAgentVersionId, snapshotToComparable };
|
|
171
|
+
export { AGENT_DIFF_OPTIONS, AGENT_EXCLUDE_PATHS, AGENT_IDENTITY_KEYS, type AgentDefinitionComparison, type AgentVersionHistoryEntry, type AgentVersionLookup, AgentVersionsError, type ComparableAgent, type ContractBreakKind, type EnrichedVersion, type PromoteVersionResult, type VersionHistoryLoad, type VersionsClient, type VersionsDbError, compareAgentDefinitions, computeVersionFetchTargets, declareContractBreak, enrichVersions, listAgentVersions, promoteAgentVersion, promoteFailureMessage, promoteSuccessMessage, readAgentCurrentVersion, readAgentVersionSnapshot, resolveAgentVersionId, snapshotToComparable };
|
package/dist/versions/index.js
CHANGED
|
@@ -91,6 +91,9 @@ function promoteFailureMessage(err) {
|
|
|
91
91
|
const reason = raw.trim();
|
|
92
92
|
return reason ? `${GENERIC}: ${reason}` : GENERIC;
|
|
93
93
|
}
|
|
94
|
+
function promoteSuccessMessage(version) {
|
|
95
|
+
return `v${version}'s settings are now current; no new version was saved`;
|
|
96
|
+
}
|
|
94
97
|
|
|
95
98
|
// versions/enrich.ts
|
|
96
99
|
import { computeDiff as computeDiff2 } from "@ai-matrx/diff/structural";
|
|
@@ -182,6 +185,12 @@ async function promoteAgentVersion(client, query) {
|
|
|
182
185
|
const result = data ?? {};
|
|
183
186
|
return { ...result, success: result.success === true };
|
|
184
187
|
}
|
|
188
|
+
async function readAgentCurrentVersion(client, agentId) {
|
|
189
|
+
const { data, error } = await client.schema("agent").from("definition").select("version").eq("id", agentId).maybeSingle();
|
|
190
|
+
if (error) throw new AgentVersionsError(error);
|
|
191
|
+
const v = data?.version;
|
|
192
|
+
return typeof v === "number" && Number.isInteger(v) ? v : null;
|
|
193
|
+
}
|
|
185
194
|
async function declareContractBreak(client, query) {
|
|
186
195
|
const { error } = await client.rpc("agx_declare_contract_break", {
|
|
187
196
|
p_agent_id: query.agentId,
|
|
@@ -202,6 +211,8 @@ export {
|
|
|
202
211
|
listAgentVersions,
|
|
203
212
|
promoteAgentVersion,
|
|
204
213
|
promoteFailureMessage,
|
|
214
|
+
promoteSuccessMessage,
|
|
215
|
+
readAgentCurrentVersion,
|
|
205
216
|
readAgentVersionSnapshot,
|
|
206
217
|
resolveAgentVersionId,
|
|
207
218
|
snapshotToComparable
|