@axiom-lattice/core 13.3.0 → 13.3.1
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/dist/index.d.mts +38 -12
- package/dist/index.d.ts +38 -12
- package/dist/index.js +58 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7688,7 +7688,7 @@ function serializePluginMeta(plugin) {
|
|
|
7688
7688
|
}
|
|
7689
7689
|
|
|
7690
7690
|
// src/sandbox_lattice/sandboxPaths.ts
|
|
7691
|
-
var NONROOT_SANDBOX_IMAGE = "kioko12520/sandbox:0.2.
|
|
7691
|
+
var NONROOT_SANDBOX_IMAGE = "kioko12520/sandbox:0.2.2";
|
|
7692
7692
|
var LEGACY_ROOT_SANDBOX_IMAGE = "kioko12520/sandbox:0.1.0";
|
|
7693
7693
|
function normalizeSandboxHome(value) {
|
|
7694
7694
|
const trimmed = value.trim();
|
|
@@ -29870,6 +29870,27 @@ var Agent = class {
|
|
|
29870
29870
|
this.queue_workspace_id = params.workspace_id === null ? null : this.workspace_id;
|
|
29871
29871
|
this.queue_project_id = params.project_id == null || params.project_id === "" ? null : this.project_id;
|
|
29872
29872
|
}
|
|
29873
|
+
/**
|
|
29874
|
+
* Re-pins scope for a dispatch without racing an in-flight run.
|
|
29875
|
+
*
|
|
29876
|
+
* Legacy entry points reuse one Agent per thread; when they carry a project
|
|
29877
|
+
* scope they must make it authoritative before the next sandbox is created.
|
|
29878
|
+
* If a run is already active, defer the update until it settles.
|
|
29879
|
+
*/
|
|
29880
|
+
applyExecutionScopeIfIdle(params) {
|
|
29881
|
+
if (this.activeExecutionPromise !== void 0) {
|
|
29882
|
+
this.pendingExecutionScope = params;
|
|
29883
|
+
return;
|
|
29884
|
+
}
|
|
29885
|
+
this.applyExecutionScope(params);
|
|
29886
|
+
}
|
|
29887
|
+
/** Applies a scope requested during the previous active execution. */
|
|
29888
|
+
applyPendingExecutionScope() {
|
|
29889
|
+
const pending = this.pendingExecutionScope;
|
|
29890
|
+
if (pending === void 0) return;
|
|
29891
|
+
this.pendingExecutionScope = void 0;
|
|
29892
|
+
this.applyExecutionScope(pending);
|
|
29893
|
+
}
|
|
29873
29894
|
/**
|
|
29874
29895
|
* Accepts host-authenticated queue metadata through the package-private symbol capability.
|
|
29875
29896
|
*
|
|
@@ -31857,7 +31878,9 @@ var Agent = class {
|
|
|
31857
31878
|
trackActiveExecution(execution) {
|
|
31858
31879
|
this.activeExecutionPromise = execution;
|
|
31859
31880
|
const clear = () => {
|
|
31860
|
-
if (this.activeExecutionPromise
|
|
31881
|
+
if (this.activeExecutionPromise !== execution) return;
|
|
31882
|
+
this.activeExecutionPromise = void 0;
|
|
31883
|
+
this.applyPendingExecutionScope();
|
|
31861
31884
|
};
|
|
31862
31885
|
void execution.then(clear, clear);
|
|
31863
31886
|
return execution;
|
|
@@ -32069,8 +32092,11 @@ var AgentInstanceManager = class _AgentInstanceManager {
|
|
|
32069
32092
|
});
|
|
32070
32093
|
}
|
|
32071
32094
|
/**
|
|
32072
|
-
* Get or create Agent instance for a thread
|
|
32073
|
-
*
|
|
32095
|
+
* Get or create Agent instance for a thread.
|
|
32096
|
+
*
|
|
32097
|
+
* Ensures only one instance per thread exists. Read-only callers should use
|
|
32098
|
+
* {@link getAgentForRead}; dispatch callers use {@link getAgentForDispatch}
|
|
32099
|
+
* so the run's project scope is applied before a sandbox is created.
|
|
32074
32100
|
*/
|
|
32075
32101
|
getAgent(params) {
|
|
32076
32102
|
const key6 = this.getKey(params);
|
|
@@ -32081,6 +32107,26 @@ var AgentInstanceManager = class _AgentInstanceManager {
|
|
|
32081
32107
|
}
|
|
32082
32108
|
return this.agents.get(key6);
|
|
32083
32109
|
}
|
|
32110
|
+
/**
|
|
32111
|
+
* Resolve the managed Agent for a dispatch and apply its explicit project.
|
|
32112
|
+
*
|
|
32113
|
+
* Legacy execution paths (channels, commands, cron, scheduler, Web App,
|
|
32114
|
+
* Open API, task comments, queue recovery) reuse the same per-thread Agent
|
|
32115
|
+
* instance. An explicit project must become authoritative before the next
|
|
32116
|
+
* sandbox is created; while a run is active it is deferred by
|
|
32117
|
+
* {@link Agent.applyExecutionScopeIfIdle}. Calls without a project do not
|
|
32118
|
+
* clear an already-established scope.
|
|
32119
|
+
*/
|
|
32120
|
+
getAgentForDispatch(params) {
|
|
32121
|
+
const agent = this.getAgent(params);
|
|
32122
|
+
if (typeof params.project_id === "string" && params.project_id.length > 0) {
|
|
32123
|
+
agent.applyExecutionScopeIfIdle({
|
|
32124
|
+
workspace_id: params.workspace_id,
|
|
32125
|
+
project_id: params.project_id
|
|
32126
|
+
});
|
|
32127
|
+
}
|
|
32128
|
+
return agent;
|
|
32129
|
+
}
|
|
32084
32130
|
/**
|
|
32085
32131
|
* Get the managed Agent for an exclusive execution and re-pin its scope.
|
|
32086
32132
|
*
|
|
@@ -32103,14 +32149,11 @@ var AgentInstanceManager = class _AgentInstanceManager {
|
|
|
32103
32149
|
/**
|
|
32104
32150
|
* Get the managed Agent for a thread WITHOUT creating or registering one.
|
|
32105
32151
|
*
|
|
32106
|
-
* Read-only control-plane callers (state, memory, inbox) must not
|
|
32107
|
-
*
|
|
32108
|
-
* `(tenant_id, assistant_id, thread_id)`, whichever caller reaches
|
|
32109
|
-
* {@link getAgent} first fixes the instance's workspace/project for its whole
|
|
32110
|
-
* lifetime, and a later trusted dispatch on that thread would then fail
|
|
32111
|
-
* trusted-scope validation. This returns the existing managed instance when
|
|
32152
|
+
* Read-only control-plane callers (state, memory, inbox) must not mutate a
|
|
32153
|
+
* thread's execution scope. This returns the existing managed instance when
|
|
32112
32154
|
* present, otherwise a transient unregistered Agent that is sufficient for
|
|
32113
|
-
* state reads and disappears with the request.
|
|
32155
|
+
* state reads and disappears with the request. Dispatch callers use
|
|
32156
|
+
* {@link getAgentForDispatch}.
|
|
32114
32157
|
*
|
|
32115
32158
|
* @param params - Thread identity; scope is only used for the transient Agent.
|
|
32116
32159
|
* @returns The managed instance if any, else an unregistered read-only Agent.
|
|
@@ -32223,7 +32266,7 @@ var DelegationService = class {
|
|
|
32223
32266
|
throw new DelegatedThreadBusyError(request.thread_id);
|
|
32224
32267
|
}
|
|
32225
32268
|
try {
|
|
32226
|
-
const agent = agentInstanceManager.
|
|
32269
|
+
const agent = agentInstanceManager.getAgentForDispatch({
|
|
32227
32270
|
assistant_id: request.assistant_id,
|
|
32228
32271
|
thread_id: request.thread_id,
|
|
32229
32272
|
tenant_id: request.tenantId,
|
|
@@ -33067,7 +33110,7 @@ function registerAgentAddMessageHandler() {
|
|
|
33067
33110
|
workspace_id: runConfigFromMetadata?.workspaceId ?? "",
|
|
33068
33111
|
project_id: runConfigFromMetadata?.projectId ?? ""
|
|
33069
33112
|
}));
|
|
33070
|
-
const agent = agentInstanceManager.
|
|
33113
|
+
const agent = agentInstanceManager.getAgentForDispatch({
|
|
33071
33114
|
tenant_id: taskInfo.tenantId,
|
|
33072
33115
|
assistant_id: taskInfo.assistantId ?? "",
|
|
33073
33116
|
thread_id: taskInfo.threadId ?? "",
|
|
@@ -42695,7 +42738,7 @@ var _LatticeEval = class _LatticeEval {
|
|
|
42695
42738
|
workspace_id: this.config.workspace_id || "default",
|
|
42696
42739
|
project_id: this.config.project_id || "default"
|
|
42697
42740
|
};
|
|
42698
|
-
const agent = agentInstanceManager.
|
|
42741
|
+
const agent = agentInstanceManager.getAgentForDispatch(agentParams);
|
|
42699
42742
|
try {
|
|
42700
42743
|
const stepInput = {
|
|
42701
42744
|
message: step.override_message || inputMessage,
|
|
@@ -44682,7 +44725,7 @@ var ThreadExecutionSupervisor = class {
|
|
|
44682
44725
|
this.probeCooldownMs = positiveOr(options.probeCooldownMs, this.cooldownMs);
|
|
44683
44726
|
this.reapEveryNTicks = positiveIntegerOr(options.reapEveryNTicks, 10);
|
|
44684
44727
|
this.maxInFlightAgeMs = positiveOr(options.maxInFlightAgeMs, 30 * 60 * 1e3);
|
|
44685
|
-
this.getAgent = options.getAgent ?? ((params) => agentInstanceManager.
|
|
44728
|
+
this.getAgent = options.getAgent ?? ((params) => agentInstanceManager.getAgentForDispatch(params));
|
|
44686
44729
|
this.probeThreadRunOwner = options.probeThreadRunOwner ?? probeThreadRunOwner;
|
|
44687
44730
|
this.log = options.log;
|
|
44688
44731
|
}
|