@tangle-network/agent-interface 0.53.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 +6 -1
- package/dist/environment-runtime.d.ts +1 -5
- package/dist/interaction-permissions.d.ts +8 -11
- package/dist/interaction-permissions.js +22 -5
- 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,7 +17,8 @@ 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
|
|
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.
|
|
21
22
|
`AgentTurnInput.interactions` and `AgentExecutionInput.interactions` carry that posture through shared execution boundaries.
|
|
22
23
|
An omitted posture leaves provider defaults unchanged, while an empty object enables no interaction kind for that turn.
|
|
23
24
|
`AgentEnvironmentCapabilitiesSchema` strictly validates the complete capability document at runtime, including all-or-nothing durable branching declarations.
|
|
@@ -116,6 +117,10 @@ const provider: AgentEnvironmentProvider = {
|
|
|
116
117
|
};
|
|
117
118
|
```
|
|
118
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
|
+
|
|
119
124
|
## Exact process environments
|
|
120
125
|
|
|
121
126
|
Providers may expose the optional `exactProcess` capability for isolated, reproducible process execution.
|
|
@@ -237,11 +237,7 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
|
|
|
237
237
|
}, z.core.$strict>;
|
|
238
238
|
}, z.core.$strict>>;
|
|
239
239
|
context: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
240
|
-
interactions: z.ZodOptional<z.
|
|
241
|
-
permission: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
-
question: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
-
plan: z.ZodOptional<z.ZodBoolean>;
|
|
244
|
-
}, z.core.$strict>>;
|
|
240
|
+
interactions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
245
241
|
signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
|
|
246
242
|
providerOptions: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
247
243
|
}, z.core.$strict>;
|
|
@@ -10,17 +10,14 @@ export declare const InteractionKind: {
|
|
|
10
10
|
};
|
|
11
11
|
export type WellKnownInteractionKind = (typeof InteractionKind)[keyof typeof InteractionKind];
|
|
12
12
|
/** Interaction kinds a provider may originate for one turn. */
|
|
13
|
-
export type RequestedInteractions =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
question: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
-
plan: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
-
}, z.core.$strict>;
|
|
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>;
|
|
24
21
|
/** Field name carrying the grant on a `permission` interaction's response. */
|
|
25
22
|
export declare const PERMISSION_GRANT_FIELD = "grant";
|
|
26
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,11 +11,27 @@ export const InteractionKind = {
|
|
|
10
11
|
/** Agent shares a plan/todo list for review/approval. */
|
|
11
12
|
Plan: "plan",
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
}
|
|
18
35
|
});
|
|
19
36
|
/** Field name carrying the grant on a `permission` interaction's response. */
|
|
20
37
|
export const PERMISSION_GRANT_FIELD = "grant";
|
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
|