@tangle-network/agent-interface 0.52.0 → 0.54.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 +8 -0
- package/dist/environment-runtime.d.ts +4 -1
- package/dist/environment-runtime.js +2 -1
- package/dist/execution-types.d.ts +3 -0
- package/dist/interaction-permissions.d.ts +9 -0
- package/dist/interaction-permissions.js +23 -0
- package/dist/profile-schema.d.ts +2 -0
- package/dist/profile-schema.js +5 -1
- package/dist/profile-security.d.ts +7 -0
- package/dist/profile-security.js +72 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,10 @@ Metadata can include caller-authored values and does not prove authorization or
|
|
|
17
17
|
Its acknowledgement repeats the operation, digest, and run coordinates and distinguishes a known cancellation effect from conflict or unknown state.
|
|
18
18
|
|
|
19
19
|
An environment advertises `interactions` only when it can originate and answer typed requests.
|
|
20
|
+
`RequestedInteractions` defines the bounded per-turn posture for well-known and namespaced provider interaction kinds.
|
|
21
|
+
`permission`, `question`, and `plan` keep portable meanings across providers.
|
|
22
|
+
`AgentTurnInput.interactions` and `AgentExecutionInput.interactions` carry that posture through shared execution boundaries.
|
|
23
|
+
An omitted posture leaves provider defaults unchanged, while an empty object enables no interaction kind for that turn.
|
|
20
24
|
`AgentEnvironmentCapabilitiesSchema` strictly validates the complete capability document at runtime, including all-or-nothing durable branching declarations.
|
|
21
25
|
Optional provider methods must be absent when their capability is false so clients cannot expose an action the provider has denied.
|
|
22
26
|
The capability names supported request kinds, answer field types, response scopes, secret answers, concurrency, replay, and response idempotency.
|
|
@@ -113,6 +117,10 @@ const provider: AgentEnvironmentProvider = {
|
|
|
113
117
|
};
|
|
114
118
|
```
|
|
115
119
|
|
|
120
|
+
When caller environment values merge into a bridge or harness process, reject names for which `isRuntimeProcessControlEnvironmentName(name)` returns `true`.
|
|
121
|
+
Use `isCredentialBearingProfileConfigName(name)` before retaining public config.
|
|
122
|
+
These checks do not apply to a replacement environment owned by caller code.
|
|
123
|
+
|
|
116
124
|
## Exact process environments
|
|
117
125
|
|
|
118
126
|
Providers may expose the optional `exactProcess` capability for isolated, reproducible process execution.
|
|
@@ -3,7 +3,7 @@ import type { AgentProfileCapabilities, AgentProfileValidationResult } from "./a
|
|
|
3
3
|
import type { InputPart } from "./parts.js";
|
|
4
4
|
import type { StreamEvent } from "./stream-events.js";
|
|
5
5
|
import type { TokenUsage } from "./execution-types.js";
|
|
6
|
-
import { type InteractionAcknowledgement, type InteractionCapabilities, type InteractionResponseCommand } from "./interaction.js";
|
|
6
|
+
import { type InteractionAcknowledgement, type InteractionCapabilities, type InteractionResponseCommand, type RequestedInteractions } from "./interaction.js";
|
|
7
7
|
import { type ContextTransferReceipt, type ContextTransferRequest, type NativeContextBoundaryProof, type NativeContextContinuationRequest, type NativeContextContinuationTurn } from "./portable-context.js";
|
|
8
8
|
import { type AgentRunCancellationAcknowledgement, type AgentRunCancellationRequest, type AgentRunControlRef } from "./runtime-control.js";
|
|
9
9
|
import type { AgentWorkspaceBranching } from "./workspace-branching.js";
|
|
@@ -28,6 +28,8 @@ export interface AgentTurnInput {
|
|
|
28
28
|
/** Verified same-session continuation; never carries duplicate history. */
|
|
29
29
|
nativeContinuation?: NativeContextContinuationRequest;
|
|
30
30
|
context?: Record<string, unknown>;
|
|
31
|
+
/** Interaction kinds the provider may originate for this turn. */
|
|
32
|
+
interactions?: RequestedInteractions;
|
|
31
33
|
signal?: AbortSignal;
|
|
32
34
|
providerOptions?: Record<string, unknown>;
|
|
33
35
|
}
|
|
@@ -235,6 +237,7 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
|
|
|
235
237
|
}, z.core.$strict>;
|
|
236
238
|
}, z.core.$strict>>;
|
|
237
239
|
context: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
240
|
+
interactions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
238
241
|
signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
|
|
239
242
|
providerOptions: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
240
243
|
}, z.core.$strict>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { InteractionCapabilitiesSchema } from "./interaction.js";
|
|
2
|
+
import { InteractionCapabilitiesSchema, RequestedInteractionsSchema } from "./interaction.js";
|
|
3
3
|
import { ContextTransferReceiptSchema, ContextTransferRequestSchema, NativeContextContinuationAcknowledgementSchema, NativeContextContinuationRequestSchema, nativeContextContinuationAcknowledgementMatches } from "./portable-context.js";
|
|
4
4
|
import { AgentExactRunControlRefSchema, AgentRunControlRefSchema, CanonicalStreamEventSchema } from "./runtime-control.js";
|
|
5
5
|
import { AgentProfileCapabilitiesSchema } from "./environment-profile-capabilities.js";
|
|
@@ -19,6 +19,7 @@ export const AgentTurnInputSchema = z.strictObject({
|
|
|
19
19
|
contextTransfer: ContextTransferRequestSchema.optional(),
|
|
20
20
|
nativeContinuation: NativeContextContinuationRequestSchema.optional(),
|
|
21
21
|
context: boundedJsonRecordSchema.optional(),
|
|
22
|
+
interactions: RequestedInteractionsSchema.optional(),
|
|
22
23
|
signal: z.custom().optional(),
|
|
23
24
|
providerOptions: boundedJsonRecordSchema.optional(),
|
|
24
25
|
});
|
|
@@ -2,6 +2,7 @@ import type { AgentExecutionOutcome, PlanContinuation } from "./plan.js";
|
|
|
2
2
|
import type { InputPart } from "./parts.js";
|
|
3
3
|
import type { ProviderConfig } from "./provider-config.js";
|
|
4
4
|
import type { InteractionExecutionBinding } from "./interaction-envelope.js";
|
|
5
|
+
import type { RequestedInteractions } from "./interaction-permissions.js";
|
|
5
6
|
export type ToolInvocation = {
|
|
6
7
|
toolName: string;
|
|
7
8
|
input: unknown;
|
|
@@ -31,6 +32,8 @@ export type AgentExecutionInput = {
|
|
|
31
32
|
sessionId?: string;
|
|
32
33
|
/** Exact run coordinates required when this turn can emit interactions. */
|
|
33
34
|
interactionBinding?: InteractionExecutionBinding;
|
|
35
|
+
/** Interaction kinds the provider may originate for this turn. */
|
|
36
|
+
interactions?: RequestedInteractions;
|
|
34
37
|
workspaceRoot?: string;
|
|
35
38
|
abortSignal?: AbortSignal;
|
|
36
39
|
headers?: Record<string, string>;
|
|
@@ -9,6 +9,15 @@ export declare const InteractionKind: {
|
|
|
9
9
|
readonly Plan: "plan";
|
|
10
10
|
};
|
|
11
11
|
export type WellKnownInteractionKind = (typeof InteractionKind)[keyof typeof InteractionKind];
|
|
12
|
+
/** Interaction kinds a provider may originate for one turn. */
|
|
13
|
+
export type RequestedInteractions = Readonly<Record<string, boolean | undefined>>;
|
|
14
|
+
/**
|
|
15
|
+
* Bounded per-turn interaction posture.
|
|
16
|
+
*
|
|
17
|
+
* The well-known keys above provide portable behavior. Namespaced keys let a
|
|
18
|
+
* provider extension use the same request, response, and replay protocol.
|
|
19
|
+
*/
|
|
20
|
+
export declare const RequestedInteractionsSchema: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
12
21
|
/** Field name carrying the grant on a `permission` interaction's response. */
|
|
13
22
|
export declare const PERMISSION_GRANT_FIELD = "grant";
|
|
14
23
|
/** Optional free-text field carrying the user's reason on a `permission` response. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { CONTRACT_MAX_MAP_ENTRIES, boundedIdentifierSchema, } from "./contract-limits.js";
|
|
2
3
|
// =============================================================================
|
|
3
4
|
// Well-known kinds + helpers.
|
|
4
5
|
// =============================================================================
|
|
@@ -10,6 +11,28 @@ export const InteractionKind = {
|
|
|
10
11
|
/** Agent shares a plan/todo list for review/approval. */
|
|
11
12
|
Plan: "plan",
|
|
12
13
|
};
|
|
14
|
+
const wellKnownInteractionKinds = new Set(Object.values(InteractionKind));
|
|
15
|
+
const requestedInteractionKindSchema = boundedIdentifierSchema.refine((value) => wellKnownInteractionKinds.has(value) ||
|
|
16
|
+
(value.includes(".") &&
|
|
17
|
+
!value.startsWith(".") &&
|
|
18
|
+
!value.endsWith(".") &&
|
|
19
|
+
!value.includes("..")), "custom interaction kind must be namespaced");
|
|
20
|
+
/**
|
|
21
|
+
* Bounded per-turn interaction posture.
|
|
22
|
+
*
|
|
23
|
+
* The well-known keys above provide portable behavior. Namespaced keys let a
|
|
24
|
+
* provider extension use the same request, response, and replay protocol.
|
|
25
|
+
*/
|
|
26
|
+
export const RequestedInteractionsSchema = z
|
|
27
|
+
.record(requestedInteractionKindSchema, z.boolean())
|
|
28
|
+
.superRefine((value, context) => {
|
|
29
|
+
if (Object.keys(value).length > CONTRACT_MAX_MAP_ENTRIES) {
|
|
30
|
+
context.addIssue({
|
|
31
|
+
code: z.ZodIssueCode.custom,
|
|
32
|
+
message: `interaction posture exceeds ${CONTRACT_MAX_MAP_ENTRIES} kinds`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
13
36
|
/** Field name carrying the grant on a `permission` interaction's response. */
|
|
14
37
|
export const PERMISSION_GRANT_FIELD = "grant";
|
|
15
38
|
/** Optional free-text field carrying the user's reason on a `permission` response. */
|
package/dist/profile-schema.d.ts
CHANGED
|
@@ -177,6 +177,8 @@ export declare const agentProfilePromptSchema: z.ZodObject<{
|
|
|
177
177
|
appendSystemPrompt: z.ZodOptional<z.ZodString>;
|
|
178
178
|
instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
179
179
|
}, z.core.$strict>;
|
|
180
|
+
/** Return true when a public config name denotes credential material. */
|
|
181
|
+
export declare function isCredentialBearingProfileConfigName(name: string): boolean;
|
|
180
182
|
export declare const agentProfilePublicConfigValueSchema: z.ZodObject<{
|
|
181
183
|
kind: z.ZodLiteral<"public">;
|
|
182
184
|
value: z.ZodString;
|
package/dist/profile-schema.js
CHANGED
|
@@ -143,6 +143,10 @@ export const agentProfilePromptSchema = z.strictObject({
|
|
|
143
143
|
});
|
|
144
144
|
const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
|
|
145
145
|
const secretCapableNamePattern = /(?:^|[_-])(?:api[_-]?key|access[_-]?key|private[_-]?key|token|secret|password|credentials?|authorization|cookie|database[_-]?url|dsn|pat)(?:[_-]|$)/i;
|
|
146
|
+
/** Return true when a public config name denotes credential material. */
|
|
147
|
+
export function isCredentialBearingProfileConfigName(name) {
|
|
148
|
+
return secretCapableNamePattern.test(name);
|
|
149
|
+
}
|
|
146
150
|
const publicProfileConfigStringSchema = z
|
|
147
151
|
.string()
|
|
148
152
|
.refine((value) => isWellFormedUnicode(value) &&
|
|
@@ -181,7 +185,7 @@ function profileConfigRecordSchema(keySchema) {
|
|
|
181
185
|
});
|
|
182
186
|
}
|
|
183
187
|
if (value.kind === "public" &&
|
|
184
|
-
|
|
188
|
+
isCredentialBearingProfileConfigName(name)) {
|
|
185
189
|
context.addIssue({
|
|
186
190
|
code: "custom",
|
|
187
191
|
path: [name],
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
* application boundary where profiles are still provider-neutral.
|
|
18
18
|
*/
|
|
19
19
|
import type { AgentProfile, AgentProfileValidationResult } from "./agent-profile.js";
|
|
20
|
+
/**
|
|
21
|
+
* Return true when an environment name can alter its owning runtime process.
|
|
22
|
+
*
|
|
23
|
+
* Apply this check when caller values merge into a bridge, sidecar, or harness
|
|
24
|
+
* process. Do not apply it to a replacement environment for caller-owned code.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isRuntimeProcessControlEnvironmentName(name: string): boolean;
|
|
20
27
|
/** Policy for {@link validateAgentProfileSecurity}. */
|
|
21
28
|
export interface AgentProfileSecurityPolicy {
|
|
22
29
|
/**
|
package/dist/profile-security.js
CHANGED
|
@@ -16,6 +16,78 @@
|
|
|
16
16
|
* own profile shape and is a different layer; this is the one to use at the
|
|
17
17
|
* application boundary where profiles are still provider-neutral.
|
|
18
18
|
*/
|
|
19
|
+
const runtimeProcessControlEnvironmentNames = new Set([
|
|
20
|
+
"ALL_PROXY",
|
|
21
|
+
"BASH_ENV",
|
|
22
|
+
"CDPATH",
|
|
23
|
+
"COMSPEC",
|
|
24
|
+
"CURL_CA_BUNDLE",
|
|
25
|
+
"DBUS_SESSION_BUS_ADDRESS",
|
|
26
|
+
"ENV",
|
|
27
|
+
"GEM_HOME",
|
|
28
|
+
"GEM_PATH",
|
|
29
|
+
"GIT_ASKPASS",
|
|
30
|
+
"GIT_PROXY_COMMAND",
|
|
31
|
+
"GIT_SSH_COMMAND",
|
|
32
|
+
"GIT_SSL_NO_VERIFY",
|
|
33
|
+
"HOME",
|
|
34
|
+
"HOMEDRIVE",
|
|
35
|
+
"HOMEPATH",
|
|
36
|
+
"HTTP_PROXY",
|
|
37
|
+
"HTTPS_PROXY",
|
|
38
|
+
"IFS",
|
|
39
|
+
"LD_AUDIT",
|
|
40
|
+
"LD_LIBRARY_PATH",
|
|
41
|
+
"LD_PRELOAD",
|
|
42
|
+
"LOGNAME",
|
|
43
|
+
"NODE_EXTRA_CA_CERTS",
|
|
44
|
+
"NODE_OPTIONS",
|
|
45
|
+
"NODE_PATH",
|
|
46
|
+
"NODE_TLS_REJECT_UNAUTHORIZED",
|
|
47
|
+
"NO_PROXY",
|
|
48
|
+
"NVM_DIR",
|
|
49
|
+
"PATH",
|
|
50
|
+
"PERL5LIB",
|
|
51
|
+
"PERL5OPT",
|
|
52
|
+
"PNPM_HOME",
|
|
53
|
+
"PROMPT_COMMAND",
|
|
54
|
+
"PWD",
|
|
55
|
+
"PYTHONHOME",
|
|
56
|
+
"PYTHONPATH",
|
|
57
|
+
"PYTHONSTARTUP",
|
|
58
|
+
"REQUESTS_CA_BUNDLE",
|
|
59
|
+
"RUBYLIB",
|
|
60
|
+
"RUBYOPT",
|
|
61
|
+
"SHELL",
|
|
62
|
+
"SHELLOPTS",
|
|
63
|
+
"SSH_ASKPASS",
|
|
64
|
+
"SSL_CERT_DIR",
|
|
65
|
+
"SSL_CERT_FILE",
|
|
66
|
+
"SSLKEYLOGFILE",
|
|
67
|
+
"TEMP",
|
|
68
|
+
"TMP",
|
|
69
|
+
"TMPDIR",
|
|
70
|
+
"USER",
|
|
71
|
+
"USERPROFILE",
|
|
72
|
+
"XDG_CACHE_HOME",
|
|
73
|
+
"XDG_CONFIG_HOME",
|
|
74
|
+
"XDG_DATA_HOME",
|
|
75
|
+
"XDG_RUNTIME_DIR",
|
|
76
|
+
"XDG_STATE_HOME",
|
|
77
|
+
]);
|
|
78
|
+
/**
|
|
79
|
+
* Return true when an environment name can alter its owning runtime process.
|
|
80
|
+
*
|
|
81
|
+
* Apply this check when caller values merge into a bridge, sidecar, or harness
|
|
82
|
+
* process. Do not apply it to a replacement environment for caller-owned code.
|
|
83
|
+
*/
|
|
84
|
+
export function isRuntimeProcessControlEnvironmentName(name) {
|
|
85
|
+
const normalized = name.toUpperCase();
|
|
86
|
+
return (runtimeProcessControlEnvironmentNames.has(normalized) ||
|
|
87
|
+
normalized.startsWith("DYLD_") ||
|
|
88
|
+
normalized.startsWith("GIT_CONFIG_") ||
|
|
89
|
+
normalized.endsWith("_PROXY"));
|
|
90
|
+
}
|
|
19
91
|
/**
|
|
20
92
|
* Default cloud policy: block the two unattended-code surfaces (local MCP,
|
|
21
93
|
* hooks); leave remote MCP and everything else to the profile. Deliberately
|