@tangle-network/agent-interface 2.20.1 → 3.0.0
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 +1 -23
- package/dist/agent-candidate-artifact-schema.d.ts +0 -4
- package/dist/agent-candidate-artifact-schema.js +1 -1
- package/dist/agent-candidate-schema-common.d.ts +0 -5
- package/dist/agent-candidate-schema-common.js +0 -27
- package/dist/agent-execution-limits.d.ts +0 -18
- package/dist/agent-execution-limits.js +0 -21
- package/dist/agent-execution-preparation.d.ts +2 -22
- package/dist/agent-execution-preparation.js +1 -25
- package/dist/agent-improvement-measurement-schema.d.ts +0 -17
- package/dist/agent-improvement-measurement-schema.js +3 -3
- package/dist/agent-improvement-source.d.ts +0 -2
- package/dist/agent-workspace-lease.d.ts +0 -23
- package/dist/agent-workspace-lease.js +0 -4
- package/dist/contract-limits.d.ts +0 -3
- package/dist/contract-limits.js +0 -10
- package/dist/environment-interactive-start.d.ts +0 -2
- package/dist/environment-interactive-start.js +1 -1
- package/dist/environment-observation.d.ts +0 -17
- package/dist/environment-observation.js +0 -13
- package/dist/environment-provider.d.ts +2 -1
- package/dist/environment-provider.js +2 -1
- package/dist/environment-runtime.d.ts +2 -16
- package/dist/environment-runtime.js +1 -5
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/interaction-fields.d.ts +0 -1
- package/dist/interaction-response-validation.d.ts +0 -5
- package/dist/interaction-response-validation.js +0 -12
- package/dist/parts.d.ts +0 -3
- package/dist/parts.js +0 -9
- package/dist/plan.d.ts +0 -8
- package/dist/plan.js +0 -6
- package/dist/profile-diff.d.ts +0 -1
- package/dist/profile-diff.js +0 -31
- package/dist/profile-kb/index.d.ts +1 -22
- package/dist/profile-kb/index.js +1 -23
- package/dist/runtime-control.d.ts +0 -61
- package/dist/runtime-control.js +0 -76
- package/dist/workspace-confidentiality.d.ts +0 -2
- package/dist/workspace-confidentiality.js +1 -1
- package/package.json +1 -11
- package/dist/agent-instance.d.ts +0 -98
- package/dist/agent-instance.js +0 -105
- package/dist/certified-context.d.ts +0 -118
- package/dist/certified-context.js +0 -220
- package/dist/environment-interactive.d.ts +0 -2
- package/dist/environment-interactive.js +0 -2
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export * from "./provider-config.js";
|
|
|
8
8
|
export * from "./host-services.js";
|
|
9
9
|
export * from "./mcp.js";
|
|
10
10
|
export * from "./provider-adapter.js";
|
|
11
|
-
export { AgentEnvironmentCapabilitiesSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema,
|
|
11
|
+
export { AgentEnvironmentCapabilitiesSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
|
|
12
12
|
export * from "./plan.js";
|
|
13
13
|
export * from "./runtime-control.js";
|
|
14
14
|
export * from "./portable-context.js";
|
|
@@ -25,14 +25,12 @@ export * from "./agent-profile-improvement.js";
|
|
|
25
25
|
export * from "./agent-profile-improvement-schema.js";
|
|
26
26
|
export * from "./agent-execution-limits.js";
|
|
27
27
|
export * from "./agent-profile.js";
|
|
28
|
-
export * from "./agent-instance.js";
|
|
29
28
|
export * from "./agent-profile-snapshot.js";
|
|
30
29
|
export * from "./agent-profile-activation.js";
|
|
31
30
|
export * from "./agent-profile-materialization.js";
|
|
32
31
|
export * from "./agent-profile-measurements.js";
|
|
33
32
|
export * from "./agent-execution-preparation.js";
|
|
34
33
|
export * from "./agent-workspace-lease.js";
|
|
35
|
-
export * from "./certified-context.js";
|
|
36
34
|
export * from "./deep-freeze.js";
|
|
37
35
|
export * from "./profile-diff.js";
|
|
38
36
|
export * from "./harness.js";
|
|
@@ -106,7 +106,6 @@ export declare const InteractionFieldTypeSchema: z.ZodEnum<{
|
|
|
106
106
|
select: "select";
|
|
107
107
|
text: "text";
|
|
108
108
|
}>;
|
|
109
|
-
export type InteractionFieldType = z.infer<typeof InteractionFieldTypeSchema>;
|
|
110
109
|
/** Scope at which an accepted answer may be reused by an explicit policy. */
|
|
111
110
|
export declare const InteractionResponseScopeSchema: z.ZodEnum<{
|
|
112
111
|
interaction: "interaction";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type InteractionRequest, type InteractionResponse, type InteractionResponseCommand } from "./interaction-envelope.js";
|
|
2
|
-
import { type InteractionValidation } from "./interaction-answer-validation.js";
|
|
3
2
|
export type InteractionResponseValidation = {
|
|
4
3
|
ok: true;
|
|
5
4
|
response: InteractionResponse;
|
|
@@ -11,7 +10,3 @@ export type InteractionResponseValidation = {
|
|
|
11
10
|
export declare function validateInteractionResponse(request: InteractionRequest, response: unknown): InteractionResponseValidation;
|
|
12
11
|
/** Validate a durable response command, including its run and request digest. */
|
|
13
12
|
export declare function validateInteractionResponseCommand(request: InteractionRequest, command: InteractionResponseCommand): InteractionResponseValidation;
|
|
14
|
-
/** Parse and return the safe response for callers that need an enumerable result. */
|
|
15
|
-
export declare function validateAndParseInteractionResponse(request: InteractionRequest, response: unknown): InteractionResponseValidation;
|
|
16
|
-
/** Verdict-only form for callers that never forward the value. */
|
|
17
|
-
export declare function interactionResponseIsValid(request: InteractionRequest, response: unknown): InteractionValidation;
|
|
@@ -88,15 +88,3 @@ export function validateInteractionResponseCommand(request, command) {
|
|
|
88
88
|
}
|
|
89
89
|
return validateInteractionResponse(parsedRequest.data, parsedCommand.data.response);
|
|
90
90
|
}
|
|
91
|
-
/** Parse and return the safe response for callers that need an enumerable result. */
|
|
92
|
-
export function validateAndParseInteractionResponse(request, response) {
|
|
93
|
-
const result = validateInteractionResponse(request, response);
|
|
94
|
-
if (!result.ok)
|
|
95
|
-
return result;
|
|
96
|
-
return { ok: true, response: result.response };
|
|
97
|
-
}
|
|
98
|
-
/** Verdict-only form for callers that never forward the value. */
|
|
99
|
-
export function interactionResponseIsValid(request, response) {
|
|
100
|
-
const result = validateInteractionResponse(request, response);
|
|
101
|
-
return result.ok ? { ok: true } : { ok: false, errors: result.errors };
|
|
102
|
-
}
|
package/dist/parts.d.ts
CHANGED
|
@@ -94,9 +94,6 @@ export type InputImagePart = {
|
|
|
94
94
|
path?: string;
|
|
95
95
|
};
|
|
96
96
|
export type InputPart = InputTextPart | InputFilePart | InputImagePart;
|
|
97
|
-
export declare function isInputTextPart(part: InputPart): part is InputTextPart;
|
|
98
|
-
export declare function isInputFilePart(part: InputPart): part is InputFilePart;
|
|
99
|
-
export declare function isInputImagePart(part: InputPart): part is InputImagePart;
|
|
100
97
|
export declare function normalizeInputParts(input: {
|
|
101
98
|
message?: string;
|
|
102
99
|
parts?: InputPart[];
|
package/dist/parts.js
CHANGED
|
@@ -13,15 +13,6 @@ export function isFilePart(part) {
|
|
|
13
13
|
export function isSubtaskPart(part) {
|
|
14
14
|
return part.type === "subtask";
|
|
15
15
|
}
|
|
16
|
-
export function isInputTextPart(part) {
|
|
17
|
-
return part.type === "text";
|
|
18
|
-
}
|
|
19
|
-
export function isInputFilePart(part) {
|
|
20
|
-
return part.type === "file";
|
|
21
|
-
}
|
|
22
|
-
export function isInputImagePart(part) {
|
|
23
|
-
return part.type === "image";
|
|
24
|
-
}
|
|
25
16
|
export function normalizeInputParts(input) {
|
|
26
17
|
if (Array.isArray(input.parts) && input.parts.length > 0) {
|
|
27
18
|
return input.parts;
|
package/dist/plan.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
/** Harnesses with an enforceable durable-plan continuation contract. */
|
|
3
|
-
export declare const PlanProviderKindSchema: z.ZodEnum<{
|
|
4
|
-
"claude-code": "claude-code";
|
|
5
|
-
codex: "codex";
|
|
6
|
-
opencode: "opencode";
|
|
7
|
-
}>;
|
|
8
|
-
export type PlanProviderKind = z.infer<typeof PlanProviderKindSchema>;
|
|
9
2
|
/**
|
|
10
3
|
* Credential-free provider correlation committed with the plan. This union is
|
|
11
4
|
* deliberately closed: adding plan support for another harness requires an
|
|
@@ -63,7 +56,6 @@ export declare const PlanDecisionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
63
56
|
outcome: z.ZodLiteral<"rejected">;
|
|
64
57
|
feedback: z.ZodString;
|
|
65
58
|
}, z.core.$strict>], "outcome">;
|
|
66
|
-
export type PlanDecision = z.infer<typeof PlanDecisionSchema>;
|
|
67
59
|
/**
|
|
68
60
|
* Typed server-originated continuation. Adapters consume this instead of
|
|
69
61
|
* inferring approval from a free-form user message.
|
package/dist/plan.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
/** Harnesses with an enforceable durable-plan continuation contract. */
|
|
3
|
-
export const PlanProviderKindSchema = z.enum([
|
|
4
|
-
"claude-code",
|
|
5
|
-
"codex",
|
|
6
|
-
"opencode",
|
|
7
|
-
]);
|
|
8
2
|
/**
|
|
9
3
|
* Credential-free provider correlation committed with the plan. This union is
|
|
10
4
|
* deliberately closed: adding plan support for another harness requires an
|
package/dist/profile-diff.d.ts
CHANGED
|
@@ -76,5 +76,4 @@ export declare function defineAgentProfileDiff<T extends AgentProfileDiff>(diff:
|
|
|
76
76
|
export declare function diffAgentProfiles(baseline: AgentProfile, candidate: AgentProfile): AgentProfileDiff[];
|
|
77
77
|
export declare function applyAgentProfileDiff(base: AgentProfile, diff: AgentProfileDiff): AgentProfile;
|
|
78
78
|
export declare function changedAgentProfileAxes(diff: AgentProfileDiff): AgentProfileDiffAxis[];
|
|
79
|
-
export declare function pruneAgentProfileDiff(diff: AgentProfileDiff, axesToRemove: readonly AgentProfileDiffAxis[]): AgentProfileDiff;
|
|
80
79
|
export {};
|
package/dist/profile-diff.js
CHANGED
|
@@ -335,34 +335,3 @@ export function changedAgentProfileAxes(diff) {
|
|
|
335
335
|
}
|
|
336
336
|
return [...axes].sort();
|
|
337
337
|
}
|
|
338
|
-
export function pruneAgentProfileDiff(diff, axesToRemove) {
|
|
339
|
-
const removeSet = new Set(axesToRemove);
|
|
340
|
-
const set = diff.set ? { ...diff.set } : undefined;
|
|
341
|
-
const remove = diff.remove ? { ...diff.remove } : undefined;
|
|
342
|
-
if (removeSet.has("identity") && set) {
|
|
343
|
-
delete set.name;
|
|
344
|
-
delete set.description;
|
|
345
|
-
delete set.version;
|
|
346
|
-
delete set.tags;
|
|
347
|
-
}
|
|
348
|
-
if (removeSet.has("identity") && remove) {
|
|
349
|
-
delete remove.identity;
|
|
350
|
-
delete remove.tags;
|
|
351
|
-
}
|
|
352
|
-
for (const axis of agentProfileDiffPropertyAxes) {
|
|
353
|
-
if (!removeSet.has(axis))
|
|
354
|
-
continue;
|
|
355
|
-
if (set)
|
|
356
|
-
delete set[axis];
|
|
357
|
-
if (remove)
|
|
358
|
-
delete remove[axis];
|
|
359
|
-
}
|
|
360
|
-
const pruned = { ...diff };
|
|
361
|
-
setOrDelete(pruned, "set", set && Object.values(set).some((value) => value !== undefined)
|
|
362
|
-
? set
|
|
363
|
-
: undefined);
|
|
364
|
-
setOrDelete(pruned, "remove", remove && Object.values(remove).some((value) => value !== undefined)
|
|
365
|
-
? remove
|
|
366
|
-
: undefined);
|
|
367
|
-
return pruned;
|
|
368
|
-
}
|
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
* The data is plain, dated, and sourced. Composition is pure: the same profile
|
|
7
7
|
* yields the same composed profile, so profile identity stays deterministic.
|
|
8
8
|
*/
|
|
9
|
-
import { composeAgentProfileGuidance, type AgentProfile
|
|
9
|
+
import { composeAgentProfileGuidance, type AgentProfile } from "../agent-profile.js";
|
|
10
10
|
import type { HarnessType } from "../harness.js";
|
|
11
11
|
import { profileKbHarnesses } from "./harnesses.js";
|
|
12
12
|
import { profileKbModels } from "./models.js";
|
|
13
13
|
import { profileKbDiscrepancies, profileKbLearnings } from "./records.js";
|
|
14
|
-
import type { ProfileKbHarness, ProfileKbModel } from "./types.js";
|
|
15
14
|
export type * from "./types.js";
|
|
16
15
|
export type { AgentProfileGuidanceBlock, AgentProfileGuidanceChannel, AgentProfileGuidanceOptions, } from "../agent-profile.js";
|
|
17
16
|
export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses, profileKbLearnings, profileKbModels, };
|
|
@@ -20,31 +19,11 @@ export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses
|
|
|
20
19
|
* replaces blocks from these sources and keeps blocks any other layer added.
|
|
21
20
|
*/
|
|
22
21
|
export declare const PROFILE_KB_SOURCES: readonly ["harness", "model", "learning"];
|
|
23
|
-
/** Date of the latest source audit; individual historical observations retain their own dates. */
|
|
24
|
-
export declare const PROFILE_KB_CHECKED_AT = "2026-10-04";
|
|
25
|
-
/** Find a harness entry by its {@link HarnessType}. */
|
|
26
|
-
export declare function findProfileKbHarness(harness: HarnessType | string | undefined): ProfileKbHarness | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Find a model entry by id or alias.
|
|
29
|
-
*
|
|
30
|
-
* Accepts the spellings harnesses and routers use: a provider prefix
|
|
31
|
-
* (`anthropic/claude-opus-5-5`), a route prefix
|
|
32
|
-
* (`pi/tangle-router/deepseek/deepseek-v4.1-flash`), and a trailing `:suffix`
|
|
33
|
-
* such as pi's thinking level or a router's `:batch`. A different version is a
|
|
34
|
-
* different model and never matches.
|
|
35
|
-
*/
|
|
36
|
-
export declare function findProfileKbModel(model: string | undefined): ProfileKbModel | undefined;
|
|
37
22
|
/** Which harness and model to compose guidance for. */
|
|
38
23
|
export interface ProfileKbSelection {
|
|
39
24
|
harness?: HarnessType | string;
|
|
40
25
|
model?: string;
|
|
41
26
|
}
|
|
42
|
-
/**
|
|
43
|
-
* The guidance blocks for one harness and model: the harness's, then the
|
|
44
|
-
* model's, then any reproduced platform learnings for either. Unknown names
|
|
45
|
-
* contribute nothing.
|
|
46
|
-
*/
|
|
47
|
-
export declare function profileKbGuidance(selection: ProfileKbSelection): AgentProfileGuidanceBlock[];
|
|
48
27
|
/**
|
|
49
28
|
* Compose harness, model, and profile guidance into the profile's prompt.
|
|
50
29
|
*
|
package/dist/profile-kb/index.js
CHANGED
|
@@ -18,14 +18,6 @@ export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses
|
|
|
18
18
|
* replaces blocks from these sources and keeps blocks any other layer added.
|
|
19
19
|
*/
|
|
20
20
|
export const PROFILE_KB_SOURCES = ["harness", "model", "learning"];
|
|
21
|
-
/** Date of the latest source audit; individual historical observations retain their own dates. */
|
|
22
|
-
export const PROFILE_KB_CHECKED_AT = "2026-10-04";
|
|
23
|
-
/** Find a harness entry by its {@link HarnessType}. */
|
|
24
|
-
export function findProfileKbHarness(harness) {
|
|
25
|
-
if (!harness)
|
|
26
|
-
return undefined;
|
|
27
|
-
return profileKbHarnesses.find((entry) => entry.id === harness);
|
|
28
|
-
}
|
|
29
21
|
/*
|
|
30
22
|
* Composition reads a frozen snapshot taken at load, never the exported
|
|
31
23
|
* records. A consumer that edits an exported entry therefore cannot change
|
|
@@ -51,20 +43,6 @@ const modelIndex = (() => {
|
|
|
51
43
|
});
|
|
52
44
|
return index;
|
|
53
45
|
})();
|
|
54
|
-
/**
|
|
55
|
-
* Find a model entry by id or alias.
|
|
56
|
-
*
|
|
57
|
-
* Accepts the spellings harnesses and routers use: a provider prefix
|
|
58
|
-
* (`anthropic/claude-opus-5-5`), a route prefix
|
|
59
|
-
* (`pi/tangle-router/deepseek/deepseek-v4.1-flash`), and a trailing `:suffix`
|
|
60
|
-
* such as pi's thinking level or a router's `:batch`. A different version is a
|
|
61
|
-
* different model and never matches.
|
|
62
|
-
*/
|
|
63
|
-
export function findProfileKbModel(model) {
|
|
64
|
-
// Public lookups search the exported records as they are now; composition
|
|
65
|
-
// alone reads the frozen snapshot, so neither can desynchronize the other.
|
|
66
|
-
return matchModelName(model, (candidate) => profileKbModels.find((entry) => [entry.id, ...entry.aliases].some((name) => name.toLowerCase() === candidate)));
|
|
67
|
-
}
|
|
68
46
|
/**
|
|
69
47
|
* Try the name as given, then without each leading `provider/` or route
|
|
70
48
|
* segment, after dropping a trailing `:suffix`.
|
|
@@ -108,7 +86,7 @@ function bullets(lines) {
|
|
|
108
86
|
* model's, then any reproduced platform learnings for either. Unknown names
|
|
109
87
|
* contribute nothing.
|
|
110
88
|
*/
|
|
111
|
-
|
|
89
|
+
function profileKbGuidance(selection) {
|
|
112
90
|
const harness = selection.harness
|
|
113
91
|
? harnessSnapshot[harnessPosition(selection.harness)]
|
|
114
92
|
: undefined;
|
|
@@ -103,67 +103,6 @@ export declare const AgentRunCancellationAcknowledgementSchema: z.ZodObject<{
|
|
|
103
103
|
existingRequestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
|
|
104
104
|
}, z.core.$strict>;
|
|
105
105
|
export declare function agentRunCancellationAcknowledgementMatchesRequest(request: AgentRunCancellationRequest, acknowledgement: AgentRunCancellationAcknowledgement): boolean;
|
|
106
|
-
export type AgentRunControlAction = "steer" | "cancel" | "status" | "reconnect";
|
|
107
|
-
export interface AgentRunControlRequestMaterial {
|
|
108
|
-
operationId: string;
|
|
109
|
-
action: AgentRunControlAction;
|
|
110
|
-
run: AgentExactRunControlRef;
|
|
111
|
-
payload?: Record<string, unknown>;
|
|
112
|
-
}
|
|
113
|
-
export interface AgentRunControlRequest extends AgentRunControlRequestMaterial {
|
|
114
|
-
requestDigest: Sha256Digest;
|
|
115
|
-
}
|
|
116
|
-
export declare function agentRunControlRequestDigest(request: AgentRunControlRequestMaterial): Sha256Digest;
|
|
117
|
-
export declare const AgentRunControlRequestSchema: z.ZodObject<{
|
|
118
|
-
operationId: z.ZodString;
|
|
119
|
-
action: z.ZodEnum<{
|
|
120
|
-
cancel: "cancel";
|
|
121
|
-
reconnect: "reconnect";
|
|
122
|
-
status: "status";
|
|
123
|
-
steer: "steer";
|
|
124
|
-
}>;
|
|
125
|
-
run: z.ZodObject<{
|
|
126
|
-
runId: z.ZodString;
|
|
127
|
-
provider: z.ZodString;
|
|
128
|
-
environmentId: z.ZodString;
|
|
129
|
-
sessionId: z.ZodString;
|
|
130
|
-
executionId: z.ZodString;
|
|
131
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
132
|
-
}, z.core.$strict>;
|
|
133
|
-
payload: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
134
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
135
|
-
}, z.core.$strict>;
|
|
136
|
-
export interface AgentRunControlAcknowledgement {
|
|
137
|
-
operationId: string;
|
|
138
|
-
requestDigest: Sha256Digest;
|
|
139
|
-
run: AgentExactRunControlRef;
|
|
140
|
-
status: "accepted" | "replayed" | "conflict" | "unknown";
|
|
141
|
-
message?: string;
|
|
142
|
-
retryable?: boolean;
|
|
143
|
-
existingRequestDigest?: Sha256Digest;
|
|
144
|
-
}
|
|
145
|
-
export declare const AgentRunControlAcknowledgementSchema: z.ZodObject<{
|
|
146
|
-
operationId: z.ZodString;
|
|
147
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
148
|
-
run: z.ZodObject<{
|
|
149
|
-
runId: z.ZodString;
|
|
150
|
-
provider: z.ZodString;
|
|
151
|
-
environmentId: z.ZodString;
|
|
152
|
-
sessionId: z.ZodString;
|
|
153
|
-
executionId: z.ZodString;
|
|
154
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
155
|
-
}, z.core.$strict>;
|
|
156
|
-
status: z.ZodEnum<{
|
|
157
|
-
accepted: "accepted";
|
|
158
|
-
conflict: "conflict";
|
|
159
|
-
replayed: "replayed";
|
|
160
|
-
unknown: "unknown";
|
|
161
|
-
}>;
|
|
162
|
-
message: z.ZodOptional<z.ZodString>;
|
|
163
|
-
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
164
|
-
existingRequestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
|
|
165
|
-
}, z.core.$strict>;
|
|
166
|
-
export declare function agentRunControlAcknowledgementMatchesRequest(request: AgentRunControlRequest, acknowledgement: AgentRunControlAcknowledgement): boolean;
|
|
167
106
|
export declare const CanonicalStreamEventSchema: z.ZodType<StreamEvent>;
|
|
168
107
|
/** Ordered, replayable envelope around the existing canonical event union. */
|
|
169
108
|
export interface RuntimeEventEnvelope {
|
package/dist/runtime-control.js
CHANGED
|
@@ -125,82 +125,6 @@ export function agentRunCancellationAcknowledgementMatchesRequest(request, ackno
|
|
|
125
125
|
exactAcknowledgement.data.requestDigest === exactRequest.data.requestDigest &&
|
|
126
126
|
sameAgentRunControlRef(exactAcknowledgement.data.run, exactRequest.data.run));
|
|
127
127
|
}
|
|
128
|
-
export function agentRunControlRequestDigest(request) {
|
|
129
|
-
const parsed = AgentRunControlRequestMaterialSchema.parse(request);
|
|
130
|
-
return canonicalCandidateDigest({
|
|
131
|
-
operationId: parsed.operationId,
|
|
132
|
-
action: parsed.action,
|
|
133
|
-
run: parsed.run,
|
|
134
|
-
...(parsed.payload === undefined ? {} : { payload: parsed.payload }),
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
const AgentRunControlRequestMaterialSchema = z.strictObject({
|
|
138
|
-
operationId: stableIdSchema,
|
|
139
|
-
action: z.enum(["steer", "cancel", "status", "reconnect"]),
|
|
140
|
-
run: AgentExactRunControlRefSchema,
|
|
141
|
-
payload: boundedJsonRecordSchema.optional(),
|
|
142
|
-
});
|
|
143
|
-
export const AgentRunControlRequestSchema = z
|
|
144
|
-
.strictObject({
|
|
145
|
-
...AgentRunControlRequestMaterialSchema.shape,
|
|
146
|
-
requestDigest: sha256DigestSchema,
|
|
147
|
-
})
|
|
148
|
-
.superRefine((request, refinement) => {
|
|
149
|
-
const { requestDigest: _requestDigest, ...material } = request;
|
|
150
|
-
if (request.requestDigest !== agentRunControlRequestDigest(material)) {
|
|
151
|
-
refinement.addIssue({
|
|
152
|
-
code: "custom",
|
|
153
|
-
path: ["requestDigest"],
|
|
154
|
-
message: "run control request digest does not match its content",
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
export const AgentRunControlAcknowledgementSchema = z
|
|
159
|
-
.strictObject({
|
|
160
|
-
operationId: stableIdSchema,
|
|
161
|
-
requestDigest: sha256DigestSchema,
|
|
162
|
-
run: AgentExactRunControlRefSchema,
|
|
163
|
-
status: z.enum(["accepted", "replayed", "conflict", "unknown"]),
|
|
164
|
-
message: boundedStringSchema.min(1).optional(),
|
|
165
|
-
retryable: z.boolean().optional(),
|
|
166
|
-
existingRequestDigest: sha256DigestSchema.optional(),
|
|
167
|
-
})
|
|
168
|
-
.superRefine((acknowledgement, refinement) => {
|
|
169
|
-
if (acknowledgement.status === "conflict" &&
|
|
170
|
-
(acknowledgement.existingRequestDigest === undefined ||
|
|
171
|
-
acknowledgement.existingRequestDigest === acknowledgement.requestDigest)) {
|
|
172
|
-
refinement.addIssue({
|
|
173
|
-
code: "custom",
|
|
174
|
-
path: ["existingRequestDigest"],
|
|
175
|
-
message: "a control conflict must identify a different existing request",
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
if (acknowledgement.status !== "conflict" &&
|
|
179
|
-
acknowledgement.existingRequestDigest !== undefined) {
|
|
180
|
-
refinement.addIssue({
|
|
181
|
-
code: "custom",
|
|
182
|
-
path: ["existingRequestDigest"],
|
|
183
|
-
message: "only a control conflict may include an existing digest",
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
if (acknowledgement.status === "unknown" &&
|
|
187
|
-
(acknowledgement.message === undefined || acknowledgement.retryable !== false)) {
|
|
188
|
-
refinement.addIssue({
|
|
189
|
-
code: "custom",
|
|
190
|
-
path: ["retryable"],
|
|
191
|
-
message: "an unknown control outcome must be explicit and non-repeatable",
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
export function agentRunControlAcknowledgementMatchesRequest(request, acknowledgement) {
|
|
196
|
-
const exactRequest = AgentRunControlRequestSchema.safeParse(request);
|
|
197
|
-
const exactAcknowledgement = AgentRunControlAcknowledgementSchema.safeParse(acknowledgement);
|
|
198
|
-
if (!exactRequest.success || !exactAcknowledgement.success)
|
|
199
|
-
return false;
|
|
200
|
-
return (exactAcknowledgement.data.operationId === exactRequest.data.operationId &&
|
|
201
|
-
exactAcknowledgement.data.requestDigest === exactRequest.data.requestDigest &&
|
|
202
|
-
sameAgentRunControlRef(exactAcknowledgement.data.run, exactRequest.data.run));
|
|
203
|
-
}
|
|
204
128
|
const unknownRecordSchema = boundedJsonRecordSchema;
|
|
205
129
|
const partBase = {
|
|
206
130
|
id: stableIdSchema,
|
|
@@ -41,8 +41,6 @@ export declare const ConfidentialExecutionRequestSchema: z.ZodObject<{
|
|
|
41
41
|
profileDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
|
|
42
42
|
}, z.core.$strict>;
|
|
43
43
|
export type ConfidentialExecutionRequest = z.infer<typeof ConfidentialExecutionRequestSchema>;
|
|
44
|
-
/** Match one requested TEE against a provider-reported TEE identifier. */
|
|
45
|
-
export declare function confidentialTeeMatchesRequest(requested: string | undefined, attested: string | undefined): boolean;
|
|
46
44
|
export interface ConfidentialExecutionEnvironment {
|
|
47
45
|
provider: string;
|
|
48
46
|
environmentId: string;
|
|
@@ -101,7 +101,7 @@ function normalizedTeeId(value) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
/** Match one requested TEE against a provider-reported TEE identifier. */
|
|
104
|
-
|
|
104
|
+
function confidentialTeeMatchesRequest(requested, attested) {
|
|
105
105
|
if (attested === undefined)
|
|
106
106
|
return requested === undefined;
|
|
107
107
|
const normalizedAttested = normalizedTeeId(attested);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-interface",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,11 +17,6 @@
|
|
|
17
17
|
"types": "./dist/environment-provider.d.ts",
|
|
18
18
|
"default": "./dist/environment-provider.js"
|
|
19
19
|
},
|
|
20
|
-
"./environment-interactive": {
|
|
21
|
-
"import": "./dist/environment-interactive.js",
|
|
22
|
-
"types": "./dist/environment-interactive.d.ts",
|
|
23
|
-
"default": "./dist/environment-interactive.js"
|
|
24
|
-
},
|
|
25
20
|
"./environment-interactive-control": {
|
|
26
21
|
"import": "./dist/environment-interactive-control.js",
|
|
27
22
|
"types": "./dist/environment-interactive-control.d.ts",
|
|
@@ -32,11 +27,6 @@
|
|
|
32
27
|
"types": "./dist/agent-profile.d.ts",
|
|
33
28
|
"default": "./dist/agent-profile.js"
|
|
34
29
|
},
|
|
35
|
-
"./agent-instance": {
|
|
36
|
-
"import": "./dist/agent-instance.js",
|
|
37
|
-
"types": "./dist/agent-instance.d.ts",
|
|
38
|
-
"default": "./dist/agent-instance.js"
|
|
39
|
-
},
|
|
40
30
|
"./profile-snapshot": {
|
|
41
31
|
"import": "./dist/agent-profile-snapshot.js",
|
|
42
32
|
"types": "./dist/agent-profile-snapshot.d.ts",
|
package/dist/agent-instance.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { Sha256Digest } from "./agent-candidate.js";
|
|
3
|
-
import type { AgentProfile } from "./agent-profile.js";
|
|
4
|
-
import type { HarnessType } from "./harness.js";
|
|
5
|
-
/** Lifecycle state of one managed Agent inside an execution environment. */
|
|
6
|
-
export declare const AGENT_INSTANCE_STATUSES: readonly ["starting", "ready", "busy", "failed", "stopped"];
|
|
7
|
-
export type AgentInstanceStatus = (typeof AGENT_INSTANCE_STATUSES)[number];
|
|
8
|
-
/**
|
|
9
|
-
* How one Agent sees the provider-owned workspace.
|
|
10
|
-
*
|
|
11
|
-
* `shared` is ordinary same-computer visibility. `isolated` requests a private
|
|
12
|
-
* writable view with provider-defined inspect or commit behavior. Neither mode
|
|
13
|
-
* is a security boundary between mutually untrusted Agents.
|
|
14
|
-
*/
|
|
15
|
-
export declare const AGENT_INSTANCE_WORKSPACE_MODES: readonly ["shared", "isolated"];
|
|
16
|
-
export type AgentInstanceWorkspaceMode = (typeof AGENT_INSTANCE_WORKSPACE_MODES)[number];
|
|
17
|
-
export interface AgentInstanceWorkspace {
|
|
18
|
-
mode: AgentInstanceWorkspaceMode;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Provider-neutral request to start one managed Agent inside an existing
|
|
22
|
-
* execution environment.
|
|
23
|
-
*
|
|
24
|
-
* Omitting `profile` asks the provider for its default Agent configuration.
|
|
25
|
-
* Omitting `workspace` selects the provider's documented default. A profile
|
|
26
|
-
* never implies another VM.
|
|
27
|
-
*/
|
|
28
|
-
export interface AgentInstanceSpec {
|
|
29
|
-
/** Stable caller-selected id or idempotency key, when supported. */
|
|
30
|
-
id?: string;
|
|
31
|
-
/** Human-readable label; not immutable identity. */
|
|
32
|
-
name?: string;
|
|
33
|
-
/** Exact portable profile for this Agent. */
|
|
34
|
-
profile?: AgentProfile;
|
|
35
|
-
/** Optional execution override; otherwise the profile or provider decides. */
|
|
36
|
-
harness?: HarnessType;
|
|
37
|
-
workspace?: AgentInstanceWorkspace;
|
|
38
|
-
}
|
|
39
|
-
/** Credential-free identity of the profile bound to an Agent instance. */
|
|
40
|
-
export interface AgentInstanceProfileIdentity {
|
|
41
|
-
name?: string;
|
|
42
|
-
digest: Sha256Digest;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Public failure summary. Providers must remove credentials and private
|
|
46
|
-
* implementation details before publishing this value.
|
|
47
|
-
*/
|
|
48
|
-
export interface AgentInstanceFailure {
|
|
49
|
-
code?: string;
|
|
50
|
-
message: string;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Portable snapshot of one managed Agent.
|
|
54
|
-
*
|
|
55
|
-
* The record deliberately excludes the full profile, provider request,
|
|
56
|
-
* credentials, grants, process ids, placement, and fencing state.
|
|
57
|
-
*/
|
|
58
|
-
export interface AgentInstanceRecord {
|
|
59
|
-
kind: "agent-instance";
|
|
60
|
-
schemaVersion: 1;
|
|
61
|
-
id: string;
|
|
62
|
-
name?: string;
|
|
63
|
-
profile?: AgentInstanceProfileIdentity;
|
|
64
|
-
/** Effective harness after profile and caller override resolution. */
|
|
65
|
-
harness?: HarnessType;
|
|
66
|
-
workspace: AgentInstanceWorkspace;
|
|
67
|
-
status: AgentInstanceStatus;
|
|
68
|
-
failure?: AgentInstanceFailure;
|
|
69
|
-
createdAtMs: number;
|
|
70
|
-
updatedAtMs: number;
|
|
71
|
-
}
|
|
72
|
-
export interface AgentInstanceStopRequest {
|
|
73
|
-
agentId: string;
|
|
74
|
-
/** Provider-defined hard termination after graceful stop cannot complete. */
|
|
75
|
-
force?: boolean;
|
|
76
|
-
}
|
|
77
|
-
export interface AgentInstanceStopAcknowledgement {
|
|
78
|
-
agentId: string;
|
|
79
|
-
outcome: "stopped" | "already-stopped" | "not-found";
|
|
80
|
-
}
|
|
81
|
-
export declare const agentInstanceStatusSchema: z.ZodEnum<{
|
|
82
|
-
busy: "busy";
|
|
83
|
-
failed: "failed";
|
|
84
|
-
ready: "ready";
|
|
85
|
-
starting: "starting";
|
|
86
|
-
stopped: "stopped";
|
|
87
|
-
}>;
|
|
88
|
-
export declare const agentInstanceWorkspaceModeSchema: z.ZodEnum<{
|
|
89
|
-
isolated: "isolated";
|
|
90
|
-
shared: "shared";
|
|
91
|
-
}>;
|
|
92
|
-
export declare const agentInstanceWorkspaceSchema: z.ZodType<AgentInstanceWorkspace>;
|
|
93
|
-
export declare const agentInstanceSpecSchema: z.ZodType<AgentInstanceSpec>;
|
|
94
|
-
export declare const agentInstanceProfileIdentitySchema: z.ZodType<AgentInstanceProfileIdentity>;
|
|
95
|
-
export declare const agentInstanceFailureSchema: z.ZodType<AgentInstanceFailure>;
|
|
96
|
-
export declare const agentInstanceRecordSchema: z.ZodType<AgentInstanceRecord>;
|
|
97
|
-
export declare const agentInstanceStopRequestSchema: z.ZodType<AgentInstanceStopRequest>;
|
|
98
|
-
export declare const agentInstanceStopAcknowledgementSchema: z.ZodType<AgentInstanceStopAcknowledgement>;
|