@ai-matrx/agents 0.59.179 → 0.59.181
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 +12 -6
- 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 +6 -6
package/dist/models/index.d.ts
CHANGED
|
@@ -897,6 +897,30 @@ declare function isSupersedable(node: SuccessionNode): boolean;
|
|
|
897
897
|
declare function resolveSuccessor(modelId: string, index: SuccessionIndex): string;
|
|
898
898
|
/** Test seam: forget which broken chains were already logged. */
|
|
899
899
|
declare function resetSuccessionLogForTests(): void;
|
|
900
|
+
/** The read `resolveLiveModelId` makes: a supabase-js client fits it as is. */
|
|
901
|
+
interface SuccessionClient {
|
|
902
|
+
schema(name: "ai"): {
|
|
903
|
+
from(table: "model_public"): {
|
|
904
|
+
select(columns: string): {
|
|
905
|
+
in(column: string, values: readonly string[]): PromiseLike<{
|
|
906
|
+
data: unknown;
|
|
907
|
+
error: {
|
|
908
|
+
message: string;
|
|
909
|
+
} | null;
|
|
910
|
+
}>;
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* The model a NEW record should be written with: `modelId` followed along its successor chain, read
|
|
917
|
+
* hop by hop from `ai.model_public`. A creation default pinned in code (a blank agent's model)
|
|
918
|
+
* outlives the model it names; writing it as is made every new agent start on a superseded model
|
|
919
|
+
* that the picker then healed on first view, so a brand-new agent showed an unsaved model change
|
|
920
|
+
* nobody made (Lane D walk, 2026-10-21). A read failure keeps `modelId` and logs: creation never
|
|
921
|
+
* fails over a name.
|
|
922
|
+
*/
|
|
923
|
+
declare function resolveLiveModelId(client: SuccessionClient, modelId: string): Promise<string>;
|
|
900
924
|
|
|
901
925
|
/**
|
|
902
926
|
* `@ai-matrx/agents/models` — downloadable (local) models: the catalog shape every client reads, the
|
|
@@ -1516,4 +1540,4 @@ declare function curatedList<T extends CuratedModel>(models: readonly T[], { off
|
|
|
1516
1540
|
offeredOnly: boolean;
|
|
1517
1541
|
}): T[];
|
|
1518
1542
|
|
|
1519
|
-
export { type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogModel, type CatalogTier, type CompatStatus, type ContentType, type CuratedCatalogClient, type CuratedModel, type CuratedPresentation, type CuratedVariant, DEFAULT_CAPABILITIES, type DecidedBy, type DeviceGraphics, type DeviceHardware, type DiscoveryAmbiguity, type DiscoveryArtifact, type DiscoveryMedia, type DiscoveryResult, type DiscoveryRuntime, type DiscoverySource, type DiscoveryVariant, EMPTY_MODEL_RECORDS, FEATURE_BUCKETS, FEATURE_BUCKET_ORDER, FEATURE_KEYS, FILE_TYPE_QUANT, type FeatureBucket, type FeatureBucketMeta, type FeatureKey, GgufError, type GgufHeader, type GgufRead, type GgufTensor, type GroupedFeatures, type HardwareClass, type HardwareClasses, type HeaderFlag, type HeaderJudgement, type HeaderRefusal, INPUT_MODALITIES, INTERACTION_MODES, type Interaction, type InteractionMode, type LocalArtifact, type LocalCompatRow, type LocalModel, type LocalModelCatalog, type LocalPresentation, type LocalRuntime, type LocalRuntimeBuild, type LocalVariant, MAX_SUCCESSION_HOPS, MODEL_FAVORITE_ENTITY_TYPE, type Modality, type ModelCapabilities, type ModelCatalog, type ModelCatalogClient, type ModelCatalogConfig, type ModelCatalogErrorSink, type ModelCatalogPgError, type ModelCatalogPgResult, type ModelCatalogQuery, type ModelCatalogState, type ModelCatalogVariant, type ModelCatalogVariantState, type ModelClassConfig, type ModelClassEntry, type ModelClassIndex, type ModelDiagnosticEntry, type ModelDiagnosticsSink, type ModelFavorites, type ModelFavoritesCache, type ModelFavoritesClient, type ModelFavoritesConfig, type ModelFavoritesErrorSink, type ModelFavoritesState, type ModelFetchScope, type ModelFileHandle, type ModelFit, type ModelIdentityRow, type ModelJson, type ModelOfferingRow, type ModelOption, type ModelOptionWithLifecycle, type ModelRecord, type ModelRecordFetchType, type ModelRecords, type ModelRecordsClient, type ModelRecordsConfig, type ModelRecordsState, type ModelSelectionPurpose, type ModelSetEnv, type ModelSetFacts, type ModelSetValidation, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type RankedVariant, SERVICE_LABEL, SERVICE_LABEL_PLURAL, type SelectDevice, type Selection, type ShardName, type SuccessionIndex, type SuccessionNode, TOP_TIER_COST_RATING, TOP_TIER_LOCKED_TITLE, type VariantDiscovery, type Want, acceptsTextInstructions, buildModelClassIndex, buildSuccessionIndex, catalogForApp, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isContentType, isConversationalModelCapability, isDecisionModelCapability, isFeatureKey, isHelperGguf, isInteractionMode, isLocalModelCatalog, isManagedAgentModelCapability, isProjectorName, isSupersedable, isTopTierRating, judgeHeaderFacts, mergeAuditRecordIntoCapabilities, missingShards, modelClassKnobFor, modelClassName, modelClassPinOf, modelsForSelectionPurpose, normalizeArch, normalizeModel, normalizeModels, normalizeOs, normalizePromptSettings, orderCatalogGroups, orderCatalogModels, outputFormatControlKey, parseCapabilities, pickProjector, priceTierRating, quantFromName, rankVariants, readGgufHeader, reconcileModelFavoriteIds, reportModelDiagnostic, requireCanonicalCapabilities, requiredArtifacts, resetSuccessionLogForTests, resolvePreferredModelChoice, resolveSuccessor, selectActiveModels, selectActiveModelsReady, selectAllModelOptions, selectAllModels, selectAllModelsReady, selectDeprecatedModels, selectDeprecatedModelsReady, selectModelById, selectModelClassConfig, selectModelClassName, selectModelControls, selectModelDetailError, selectModelFetchType, selectModelFullyLoaded, selectModelIdentityById, selectModelIdentityLookupStatus, selectModelLabelById, selectModelLabelWithClass, selectModelNameById, selectModelOptions, selectVariant, serviceCountLabel, setModelDiagnosticsSink, shapeCuratedModels, shardFileName, shardName, speedRatingLabel, speedRatingWord, splitSetProblems, toAuditRecord, validateModelSet, withModelClass };
|
|
1543
|
+
export { type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogModel, type CatalogTier, type CompatStatus, type ContentType, type CuratedCatalogClient, type CuratedModel, type CuratedPresentation, type CuratedVariant, DEFAULT_CAPABILITIES, type DecidedBy, type DeviceGraphics, type DeviceHardware, type DiscoveryAmbiguity, type DiscoveryArtifact, type DiscoveryMedia, type DiscoveryResult, type DiscoveryRuntime, type DiscoverySource, type DiscoveryVariant, EMPTY_MODEL_RECORDS, FEATURE_BUCKETS, FEATURE_BUCKET_ORDER, FEATURE_KEYS, FILE_TYPE_QUANT, type FeatureBucket, type FeatureBucketMeta, type FeatureKey, GgufError, type GgufHeader, type GgufRead, type GgufTensor, type GroupedFeatures, type HardwareClass, type HardwareClasses, type HeaderFlag, type HeaderJudgement, type HeaderRefusal, INPUT_MODALITIES, INTERACTION_MODES, type Interaction, type InteractionMode, type LocalArtifact, type LocalCompatRow, type LocalModel, type LocalModelCatalog, type LocalPresentation, type LocalRuntime, type LocalRuntimeBuild, type LocalVariant, MAX_SUCCESSION_HOPS, MODEL_FAVORITE_ENTITY_TYPE, type Modality, type ModelCapabilities, type ModelCatalog, type ModelCatalogClient, type ModelCatalogConfig, type ModelCatalogErrorSink, type ModelCatalogPgError, type ModelCatalogPgResult, type ModelCatalogQuery, type ModelCatalogState, type ModelCatalogVariant, type ModelCatalogVariantState, type ModelClassConfig, type ModelClassEntry, type ModelClassIndex, type ModelDiagnosticEntry, type ModelDiagnosticsSink, type ModelFavorites, type ModelFavoritesCache, type ModelFavoritesClient, type ModelFavoritesConfig, type ModelFavoritesErrorSink, type ModelFavoritesState, type ModelFetchScope, type ModelFileHandle, type ModelFit, type ModelIdentityRow, type ModelJson, type ModelOfferingRow, type ModelOption, type ModelOptionWithLifecycle, type ModelRecord, type ModelRecordFetchType, type ModelRecords, type ModelRecordsClient, type ModelRecordsConfig, type ModelRecordsState, type ModelSelectionPurpose, type ModelSetEnv, type ModelSetFacts, type ModelSetValidation, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type RankedVariant, SERVICE_LABEL, SERVICE_LABEL_PLURAL, type SelectDevice, type Selection, type ShardName, type SuccessionClient, type SuccessionIndex, type SuccessionNode, TOP_TIER_COST_RATING, TOP_TIER_LOCKED_TITLE, type VariantDiscovery, type Want, acceptsTextInstructions, buildModelClassIndex, buildSuccessionIndex, catalogForApp, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isContentType, isConversationalModelCapability, isDecisionModelCapability, isFeatureKey, isHelperGguf, isInteractionMode, isLocalModelCatalog, isManagedAgentModelCapability, isProjectorName, isSupersedable, isTopTierRating, judgeHeaderFacts, mergeAuditRecordIntoCapabilities, missingShards, modelClassKnobFor, modelClassName, modelClassPinOf, modelsForSelectionPurpose, normalizeArch, normalizeModel, normalizeModels, normalizeOs, normalizePromptSettings, orderCatalogGroups, orderCatalogModels, outputFormatControlKey, parseCapabilities, pickProjector, priceTierRating, quantFromName, rankVariants, readGgufHeader, reconcileModelFavoriteIds, reportModelDiagnostic, requireCanonicalCapabilities, requiredArtifacts, resetSuccessionLogForTests, resolveLiveModelId, resolvePreferredModelChoice, resolveSuccessor, selectActiveModels, selectActiveModelsReady, selectAllModelOptions, selectAllModels, selectAllModelsReady, selectDeprecatedModels, selectDeprecatedModelsReady, selectModelById, selectModelClassConfig, selectModelClassName, selectModelControls, selectModelDetailError, selectModelFetchType, selectModelFullyLoaded, selectModelIdentityById, selectModelIdentityLookupStatus, selectModelLabelById, selectModelLabelWithClass, selectModelNameById, selectModelOptions, selectVariant, serviceCountLabel, setModelDiagnosticsSink, shapeCuratedModels, shardFileName, shardName, speedRatingLabel, speedRatingWord, splitSetProblems, toAuditRecord, validateModelSet, withModelClass };
|
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
|