@yaklabs-ai/plugin-sdk 0.9.1 → 0.11.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 -1
- package/THIRD-PARTY-INVENTORY.json +1 -1
- package/dist/disclosure.js +3 -0
- package/dist/kay-agent-testing.d.ts +52 -0
- package/dist/kay-agent-testing.js +110 -1
- package/dist/kay-agent.d.ts +39 -0
- package/dist/kay-agent.js +74 -0
- package/dist/kay-app.d.ts +58 -11
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/disclosure.js
CHANGED
|
@@ -272,6 +272,9 @@ var URI_HINT_FIELD_LIMITS = {
|
|
|
272
272
|
triggerItem: LIST_ITEM_LIMIT_CHARS
|
|
273
273
|
};
|
|
274
274
|
|
|
275
|
+
// packages/herd-agent/dist/core/tools/produced-resources.js
|
|
276
|
+
var DECLARATIONS = Symbol.for("herd.producedResources.declarations");
|
|
277
|
+
|
|
275
278
|
// packages/plugin-sdk/dist/disclosure/disclosure-conformance.js
|
|
276
279
|
var PLUGIN_DISCLOSURE_RULES = [
|
|
277
280
|
// (a) the agentHint a module must ship to be discoverable at all
|
|
@@ -1498,6 +1498,58 @@ declare interface PluginServiceDescriptor {
|
|
|
1498
1498
|
readonly capabilities: readonly PluginServiceCapability[];
|
|
1499
1499
|
}
|
|
1500
1500
|
|
|
1501
|
+
/**
|
|
1502
|
+
* What a run did to a URI. The words match the automation run wire's artifact actions. When one
|
|
1503
|
+
* run both creates and updates a URI, the reader reports `created`.
|
|
1504
|
+
*/
|
|
1505
|
+
declare type ProducedResourceAction = "created" | "updated";
|
|
1506
|
+
|
|
1507
|
+
/** One URI a tool call created or updated as a side effect. */
|
|
1508
|
+
declare interface ProducedResourceDeclaration {
|
|
1509
|
+
/** A `scheme://…` URI or an absolute local file path, compared as an exact string. */
|
|
1510
|
+
readonly uri: string;
|
|
1511
|
+
readonly action: ProducedResourceAction;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
/**
|
|
1515
|
+
* One tool result's declarations. `absent` covers every result that makes no claim, including a
|
|
1516
|
+
* non-object `details` and an empty list. `malformed` means a claim was made that cannot be
|
|
1517
|
+
* trusted; the reader reports a gap for it instead of keeping the parts that look valid.
|
|
1518
|
+
*/
|
|
1519
|
+
export declare type ProducedResourceDeclarationsRead = {
|
|
1520
|
+
readonly kind: "absent";
|
|
1521
|
+
} | {
|
|
1522
|
+
readonly kind: "malformed";
|
|
1523
|
+
} | {
|
|
1524
|
+
readonly kind: "declared";
|
|
1525
|
+
readonly resources: readonly ProducedResourceDeclaration[];
|
|
1526
|
+
};
|
|
1527
|
+
|
|
1528
|
+
/**
|
|
1529
|
+
* What the automation run reader will see for one tool result's produced-resource declarations:
|
|
1530
|
+
* the result's details recorded by the same host step a session applies before persisting it,
|
|
1531
|
+
* then read through the `@herd/uri` contract. `declared` lists what `declareProducedResources`
|
|
1532
|
+
* attached, in order; `absent` means the result claims nothing, including a result whose own
|
|
1533
|
+
* details set the reserved key by hand, which the host drops.
|
|
1534
|
+
*
|
|
1535
|
+
* Stricter than the host on purpose: a declaration the contract refuses does not fail the tool
|
|
1536
|
+
* call in a session (its effect already happened; the run reports a gap instead), so a test is
|
|
1537
|
+
* where its author finds out.
|
|
1538
|
+
*
|
|
1539
|
+
* ```ts
|
|
1540
|
+
* const result = await invokeToolForTest(createPageTool, { title: "Plan" });
|
|
1541
|
+
* expect(producedResourcesForTest(result)).toEqual({
|
|
1542
|
+
* kind: "declared",
|
|
1543
|
+
* resources: [{ uri: "notion://pages/abc123", action: "created" }],
|
|
1544
|
+
* });
|
|
1545
|
+
* ```
|
|
1546
|
+
*
|
|
1547
|
+
* @throws TypeError when the result declares something the contract refuses, naming the claim.
|
|
1548
|
+
*/
|
|
1549
|
+
export declare function producedResourcesForTest(result: AgentToolResult<unknown>): Exclude<ProducedResourceDeclarationsRead, {
|
|
1550
|
+
readonly kind: "malformed";
|
|
1551
|
+
}>;
|
|
1552
|
+
|
|
1501
1553
|
declare type ProviderId = KnownProvider | string;
|
|
1502
1554
|
|
|
1503
1555
|
/**
|
|
@@ -1,3 +1,102 @@
|
|
|
1
|
+
// packages/herd-agent/dist/core/tools/tool-parameters.js
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var URI_PAYLOAD_MARKER = "x-kay-uri-payload";
|
|
4
|
+
var uriPayloadSchema = z.union([
|
|
5
|
+
z.string(),
|
|
6
|
+
z.record(z.string(), z.unknown()),
|
|
7
|
+
z.array(z.unknown()),
|
|
8
|
+
z.number(),
|
|
9
|
+
z.boolean(),
|
|
10
|
+
z.null()
|
|
11
|
+
]).meta({ [URI_PAYLOAD_MARKER]: true });
|
|
12
|
+
|
|
13
|
+
// packages/herd-uri/dist/produced-resources.js
|
|
14
|
+
var PRODUCED_RESOURCES_DETAILS_KEY = "producedResources";
|
|
15
|
+
var ABSENT = { kind: "absent" };
|
|
16
|
+
var MALFORMED = { kind: "malformed" };
|
|
17
|
+
var SCHEME_URI = /^[a-z][a-z0-9+.-]*:\/\/./;
|
|
18
|
+
var WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]./;
|
|
19
|
+
function isProducedResourceUri(value) {
|
|
20
|
+
if (typeof value !== "string" || value.trim() !== value)
|
|
21
|
+
return false;
|
|
22
|
+
return SCHEME_URI.test(value) || value.startsWith("/") && value.length > 1 || WINDOWS_ABSOLUTE_PATH.test(value);
|
|
23
|
+
}
|
|
24
|
+
function isProducedResourceDeclaration(value) {
|
|
25
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const keys = Object.keys(value);
|
|
29
|
+
if (keys.length !== 2 || !keys.includes("uri") || !keys.includes("action")) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const record = value;
|
|
33
|
+
return isProducedResourceUri(record.uri) && (record.action === "created" || record.action === "updated");
|
|
34
|
+
}
|
|
35
|
+
function readProducedResourceDeclarations(details) {
|
|
36
|
+
if (typeof details !== "object" || details === null || Array.isArray(details) || !Object.hasOwn(details, PRODUCED_RESOURCES_DETAILS_KEY)) {
|
|
37
|
+
return ABSENT;
|
|
38
|
+
}
|
|
39
|
+
const claimed = details[PRODUCED_RESOURCES_DETAILS_KEY];
|
|
40
|
+
if (!Array.isArray(claimed))
|
|
41
|
+
return MALFORMED;
|
|
42
|
+
if (claimed.length === 0)
|
|
43
|
+
return ABSENT;
|
|
44
|
+
if (!claimed.every(isProducedResourceDeclaration))
|
|
45
|
+
return MALFORMED;
|
|
46
|
+
return { kind: "declared", resources: claimed };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// packages/herd-agent/dist/core/is-object.js
|
|
50
|
+
function isObject(value) {
|
|
51
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// packages/herd-agent/dist/core/tools/produced-resources.js
|
|
55
|
+
var DECLARATIONS = Symbol.for("herd.producedResources.declarations");
|
|
56
|
+
function recordProducedResources(details) {
|
|
57
|
+
if (!isObject(details))
|
|
58
|
+
return unchanged(details);
|
|
59
|
+
const channel = channelOf(details);
|
|
60
|
+
const droppedPayloadValue = Object.hasOwn(details, PRODUCED_RESOURCES_DETAILS_KEY);
|
|
61
|
+
if (channel === void 0 && !droppedPayloadValue)
|
|
62
|
+
return unchanged(details);
|
|
63
|
+
const recorded = Object.fromEntries(Object.entries(details).filter(([key]) => key !== PRODUCED_RESOURCES_DETAILS_KEY));
|
|
64
|
+
let malformedClaim = false;
|
|
65
|
+
if (channel !== void 0) {
|
|
66
|
+
const claims = claimsFrom(channel);
|
|
67
|
+
if (claims.length > 0) {
|
|
68
|
+
recorded[PRODUCED_RESOURCES_DETAILS_KEY] = claims;
|
|
69
|
+
malformedClaim = !claims.every(isProducedResourceDeclaration);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { details: recorded, droppedPayloadValue, malformedClaim };
|
|
73
|
+
}
|
|
74
|
+
function unchanged(details) {
|
|
75
|
+
return { details, droppedPayloadValue: false, malformedClaim: false };
|
|
76
|
+
}
|
|
77
|
+
function channelOf(details) {
|
|
78
|
+
return Object.hasOwn(details, DECLARATIONS) ? details[DECLARATIONS] : void 0;
|
|
79
|
+
}
|
|
80
|
+
function claimsFrom(claimed) {
|
|
81
|
+
try {
|
|
82
|
+
return Array.isArray(claimed) ? Array.from(claimed, snapshotClaim) : [snapshotClaim(claimed)];
|
|
83
|
+
} catch (error) {
|
|
84
|
+
return [`<unreadable claim: ${typeof error}>`];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function snapshotClaim(value) {
|
|
88
|
+
if (!isObject(value))
|
|
89
|
+
return jsonValue(value);
|
|
90
|
+
const copy = Object.fromEntries(Object.entries(value).map(([key, field]) => [key, jsonValue(field)]));
|
|
91
|
+
return isProducedResourceDeclaration(copy) ? Object.freeze({ uri: copy.uri, action: copy.action }) : Object.freeze(copy);
|
|
92
|
+
}
|
|
93
|
+
function jsonValue(value) {
|
|
94
|
+
if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
return `<${Array.isArray(value) ? "array" : typeof value}>`;
|
|
98
|
+
}
|
|
99
|
+
|
|
1
100
|
// packages/herd-agent/dist/testing.js
|
|
2
101
|
function fauxAuthContext(overrides = {}) {
|
|
3
102
|
return {
|
|
@@ -81,8 +180,18 @@ function defaultTestToolContext() {
|
|
|
81
180
|
async function invokeToolForTest(tool, params, ctx = defaultTestToolContext()) {
|
|
82
181
|
return tool.execute("test-call", params, void 0, void 0, ctx);
|
|
83
182
|
}
|
|
183
|
+
function producedResourcesForTest(result) {
|
|
184
|
+
const recorded = recordProducedResources(result.details).details;
|
|
185
|
+
const read = readProducedResourceDeclarations(recorded);
|
|
186
|
+
if (read.kind === "malformed") {
|
|
187
|
+
const claim = recorded[PRODUCED_RESOURCES_DETAILS_KEY];
|
|
188
|
+
throw new TypeError(`The tool declared produced resources the contract refuses, so a run would report a gap for this call: ${JSON.stringify(claim)}. Each declaration must be exactly { uri, action }, where uri is a scheme:// URI or an absolute local path with no surrounding whitespace and action is "created" or "updated".`);
|
|
189
|
+
}
|
|
190
|
+
return read;
|
|
191
|
+
}
|
|
84
192
|
export {
|
|
85
193
|
fauxAuthContext,
|
|
86
194
|
fauxKayAgentCapabilities,
|
|
87
|
-
invokeToolForTest
|
|
195
|
+
invokeToolForTest,
|
|
196
|
+
producedResourcesForTest
|
|
88
197
|
};
|
package/dist/kay-agent.d.ts
CHANGED
|
@@ -595,6 +595,27 @@ export declare interface CurrentResourceState {
|
|
|
595
595
|
readonly content?: string | Uint8Array;
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
+
/**
|
|
599
|
+
* Declare the URIs a tool call created or updated as a side effect, on the result it returns.
|
|
600
|
+
*
|
|
601
|
+
* The declarations ride the result to the host, which records them in the transcript under the
|
|
602
|
+
* reserved `producedResources` details key, so an automation run lists them beside the URIs its
|
|
603
|
+
* `write` and `edit` calls changed. A declaration the contract refuses (not exactly `{ uri, action }`,
|
|
604
|
+
* a URI that is neither `scheme://…` nor an absolute local path, an unknown action) never fails the
|
|
605
|
+
* call, because its effect has already happened: the host records the call's claim as malformed,
|
|
606
|
+
* the run reports a gap for it, and the session logs a warning. A tool never writes the reserved key
|
|
607
|
+
* itself; the host drops whatever a result's own details hold there. Declarations ride only a
|
|
608
|
+
* returned result: a call that throws declares nothing.
|
|
609
|
+
*
|
|
610
|
+
* @param result The result the tool returns. Its `details` must be an object or `undefined`;
|
|
611
|
+
* `undefined` becomes an empty object that carries the declarations.
|
|
612
|
+
* @param declarations Each names a `scheme://` URI or an absolute local path, compared as an
|
|
613
|
+
* exact string, and whether the call `created` or `updated` it.
|
|
614
|
+
* @returns A copy of `result` carrying these declarations after any it already carried.
|
|
615
|
+
* @throws TypeError when `details` is neither an object nor `undefined`, which the types rule out.
|
|
616
|
+
*/
|
|
617
|
+
export declare function declareProducedResources<TDetails extends object | undefined>(result: AgentToolResult<TDetails>, declarations: readonly ProducedResourceDeclaration[]): AgentToolResult<DetailsWithProducedResources<TDetails>>;
|
|
618
|
+
|
|
598
619
|
/**
|
|
599
620
|
* The one-liner for an auth-gated tool (decision 002 addendum, F-19). Composes
|
|
600
621
|
* {@link toolParameters}, {@link withResolvedAuth}, and `schema.parse` so `body` receives a
|
|
@@ -685,6 +706,9 @@ declare interface DerivedToolClassification {
|
|
|
685
706
|
*/
|
|
686
707
|
export declare function describeUriTextEditTarget(grammar: UriTextEditGrammar, index: number, count: number): string;
|
|
687
708
|
|
|
709
|
+
/** `details` once it carries declarations: an `undefined` input becomes an empty object. */
|
|
710
|
+
export declare type DetailsWithProducedResources<TDetails> = TDetails extends undefined ? Record<string, never> : TDetails;
|
|
711
|
+
|
|
688
712
|
/**
|
|
689
713
|
* The execute-time auth surface the SDK wrappers read off `ctx.auth`. Slice 3 attaches a
|
|
690
714
|
* concrete implementation (vault + pkce refresh + active-account store) to ExtensionContext;
|
|
@@ -2855,6 +2879,7 @@ declare const PluginCapabilityRefusalV1: z.ZodObject<{
|
|
|
2855
2879
|
default: "default";
|
|
2856
2880
|
allow: "allow";
|
|
2857
2881
|
ask: "ask";
|
|
2882
|
+
auto: "auto";
|
|
2858
2883
|
}>>;
|
|
2859
2884
|
}, z.core.$strict>>;
|
|
2860
2885
|
fallback: z.ZodArray<z.ZodObject<{
|
|
@@ -2871,6 +2896,7 @@ declare const PluginCapabilityRefusalV1: z.ZodObject<{
|
|
|
2871
2896
|
default: "default";
|
|
2872
2897
|
allow: "allow";
|
|
2873
2898
|
ask: "ask";
|
|
2899
|
+
auto: "auto";
|
|
2874
2900
|
}>>;
|
|
2875
2901
|
}, z.core.$strict>>;
|
|
2876
2902
|
}, z.core.$strict>;
|
|
@@ -3122,6 +3148,19 @@ export declare type PluginToolDefinition<TParams extends ToolParametersWire = To
|
|
|
3122
3148
|
readonly execute: (toolCallId: string, params: ToolExecutionAwareParams<InferToolInput<TParams>>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<TDetails> | undefined, ctx: ToolContext) => Promise<AgentToolResult<TDetails>>;
|
|
3123
3149
|
};
|
|
3124
3150
|
|
|
3151
|
+
/**
|
|
3152
|
+
* What a run did to a URI. The words match the automation run wire's artifact actions. When one
|
|
3153
|
+
* run both creates and updates a URI, the reader reports `created`.
|
|
3154
|
+
*/
|
|
3155
|
+
export declare type ProducedResourceAction = "created" | "updated";
|
|
3156
|
+
|
|
3157
|
+
/** One URI a tool call created or updated as a side effect. */
|
|
3158
|
+
export declare interface ProducedResourceDeclaration {
|
|
3159
|
+
/** A `scheme://…` URI or an absolute local file path, compared as an exact string. */
|
|
3160
|
+
readonly uri: string;
|
|
3161
|
+
readonly action: ProducedResourceAction;
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3125
3164
|
declare type ProviderId = KnownProvider | string;
|
|
3126
3165
|
|
|
3127
3166
|
/**
|
package/dist/kay-agent.js
CHANGED
|
@@ -115,6 +115,26 @@ function filesystemStampDigest(revision) {
|
|
|
115
115
|
return parts.length === 6 ? parts[5] : void 0;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
// packages/herd-uri/dist/produced-resources.js
|
|
119
|
+
var SCHEME_URI = /^[a-z][a-z0-9+.-]*:\/\/./;
|
|
120
|
+
var WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]./;
|
|
121
|
+
function isProducedResourceUri(value) {
|
|
122
|
+
if (typeof value !== "string" || value.trim() !== value)
|
|
123
|
+
return false;
|
|
124
|
+
return SCHEME_URI.test(value) || value.startsWith("/") && value.length > 1 || WINDOWS_ABSOLUTE_PATH.test(value);
|
|
125
|
+
}
|
|
126
|
+
function isProducedResourceDeclaration(value) {
|
|
127
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
const keys = Object.keys(value);
|
|
131
|
+
if (keys.length !== 2 || !keys.includes("uri") || !keys.includes("action")) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
const record = value;
|
|
135
|
+
return isProducedResourceUri(record.uri) && (record.action === "created" || record.action === "updated");
|
|
136
|
+
}
|
|
137
|
+
|
|
118
138
|
// packages/herd-uri/dist/template-route.js
|
|
119
139
|
var PLACEHOLDER_RE = /<([^<>]+)>/g;
|
|
120
140
|
var REST_SUFFIX = "...";
|
|
@@ -887,6 +907,59 @@ function toToolParameters(schema) {
|
|
|
887
907
|
return rest;
|
|
888
908
|
}
|
|
889
909
|
|
|
910
|
+
// packages/herd-agent/dist/core/is-object.js
|
|
911
|
+
function isObject(value) {
|
|
912
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// packages/herd-agent/dist/core/tools/produced-resources.js
|
|
916
|
+
var DECLARATIONS = Symbol.for("herd.producedResources.declarations");
|
|
917
|
+
function declareProducedResources(result, declarations) {
|
|
918
|
+
const details = declarableDetails(result.details);
|
|
919
|
+
const claims = [...claimsOn(details), ...claimsFrom(declarations)];
|
|
920
|
+
const next = { ...details };
|
|
921
|
+
if (claims.length > 0)
|
|
922
|
+
next[DECLARATIONS] = Object.freeze(claims);
|
|
923
|
+
return {
|
|
924
|
+
...result,
|
|
925
|
+
details: next
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
function declarableDetails(details) {
|
|
929
|
+
if (details === void 0)
|
|
930
|
+
return {};
|
|
931
|
+
if (!isObject(details)) {
|
|
932
|
+
throw new TypeError(`declareProducedResources needs a tool result whose details is an object or undefined, not ${Array.isArray(details) ? "an array" : typeof details}.`);
|
|
933
|
+
}
|
|
934
|
+
return details;
|
|
935
|
+
}
|
|
936
|
+
function channelOf(details) {
|
|
937
|
+
return Object.hasOwn(details, DECLARATIONS) ? details[DECLARATIONS] : void 0;
|
|
938
|
+
}
|
|
939
|
+
function claimsOn(details) {
|
|
940
|
+
const channel = channelOf(details);
|
|
941
|
+
return channel === void 0 ? [] : claimsFrom(channel);
|
|
942
|
+
}
|
|
943
|
+
function claimsFrom(claimed) {
|
|
944
|
+
try {
|
|
945
|
+
return Array.isArray(claimed) ? Array.from(claimed, snapshotClaim) : [snapshotClaim(claimed)];
|
|
946
|
+
} catch (error) {
|
|
947
|
+
return [`<unreadable claim: ${typeof error}>`];
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
function snapshotClaim(value) {
|
|
951
|
+
if (!isObject(value))
|
|
952
|
+
return jsonValue(value);
|
|
953
|
+
const copy = Object.fromEntries(Object.entries(value).map(([key, field]) => [key, jsonValue(field)]));
|
|
954
|
+
return isProducedResourceDeclaration(copy) ? Object.freeze({ uri: copy.uri, action: copy.action }) : Object.freeze(copy);
|
|
955
|
+
}
|
|
956
|
+
function jsonValue(value) {
|
|
957
|
+
if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) {
|
|
958
|
+
return value;
|
|
959
|
+
}
|
|
960
|
+
return `<${Array.isArray(value) ? "array" : typeof value}>`;
|
|
961
|
+
}
|
|
962
|
+
|
|
890
963
|
// packages/plugin-primitives/dist/results.js
|
|
891
964
|
function textResult(text, details) {
|
|
892
965
|
const content = [{ type: "text", text }];
|
|
@@ -1309,6 +1382,7 @@ export {
|
|
|
1309
1382
|
contentResult,
|
|
1310
1383
|
createFallbackOnlyWithJev,
|
|
1311
1384
|
createJsonApiClient,
|
|
1385
|
+
declareProducedResources,
|
|
1312
1386
|
defineAuthedTool,
|
|
1313
1387
|
defineKayAgentAdvertisement,
|
|
1314
1388
|
defineTool,
|
package/dist/kay-app.d.ts
CHANGED
|
@@ -1276,9 +1276,20 @@ export declare interface KayAppAutomationContext {
|
|
|
1276
1276
|
readonly sessionId: string;
|
|
1277
1277
|
}
|
|
1278
1278
|
|
|
1279
|
-
export declare type KayAppAutomationEffect =
|
|
1279
|
+
export declare type KayAppAutomationEffect = {
|
|
1280
|
+
/**
|
|
1281
|
+
* STORED only: a binding created before the 2026-09-28 owner ruling (agents and plugins
|
|
1282
|
+
* may not create `spawn-session` automations) can still carry this effect, so a read must
|
|
1283
|
+
* still parse it. Absent from {@link KayAppAutomationEffectInput}, so no NEW binding can
|
|
1284
|
+
* be minted with it.
|
|
1285
|
+
*/
|
|
1280
1286
|
readonly kind: "spawn-session";
|
|
1281
|
-
|
|
1287
|
+
readonly prompt: string;
|
|
1288
|
+
readonly cwd?: string;
|
|
1289
|
+
readonly projectId?: string | null;
|
|
1290
|
+
/** Resolve the spawned session's model by tier instead of the caller's default. */
|
|
1291
|
+
readonly tier?: "small" | "medium" | "large" | "ultra";
|
|
1292
|
+
} | {
|
|
1282
1293
|
/** As STORED: always a reference, never inline source. */
|
|
1283
1294
|
readonly kind: "script";
|
|
1284
1295
|
readonly ref: KayAppAutomationScriptRef;
|
|
@@ -1294,6 +1305,14 @@ export declare type KayAppAutomationEffect = Extract<KayAppAutomationEffectInput
|
|
|
1294
1305
|
readonly prompt: string;
|
|
1295
1306
|
};
|
|
1296
1307
|
|
|
1308
|
+
/**
|
|
1309
|
+
* What a plugin may CREATE an automation with. `spawn-session` is deliberately absent: owner
|
|
1310
|
+
* ruling (2026-09-28) forbids a plugin (or an agent) from minting a `spawn-session` binding —
|
|
1311
|
+
* durable recurring agent work belongs to a plugin workflow (`app.workflows.define` +
|
|
1312
|
+
* `ctx.runAgent`) or a direct `app.sessions.run`. A binding created before that ruling can still
|
|
1313
|
+
* carry the effect and still reads and runs; see {@link KayAppAutomationEffect}, the STORED type
|
|
1314
|
+
* this input narrows.
|
|
1315
|
+
*/
|
|
1297
1316
|
export declare type KayAppAutomationEffectInput = {
|
|
1298
1317
|
readonly kind: "deliver-turn";
|
|
1299
1318
|
readonly prompt: string;
|
|
@@ -1307,13 +1326,6 @@ export declare type KayAppAutomationEffectInput = {
|
|
|
1307
1326
|
*/
|
|
1308
1327
|
readonly source?: string;
|
|
1309
1328
|
readonly initialState?: JsonValue_4;
|
|
1310
|
-
} | {
|
|
1311
|
-
readonly kind: "spawn-session";
|
|
1312
|
-
readonly prompt: string;
|
|
1313
|
-
readonly cwd?: string;
|
|
1314
|
-
readonly projectId?: string | null;
|
|
1315
|
-
/** Resolve the spawned session's model by tier instead of the caller's default. */
|
|
1316
|
-
readonly tier?: "small" | "medium" | "large" | "ultra";
|
|
1317
1329
|
};
|
|
1318
1330
|
|
|
1319
1331
|
/**
|
|
@@ -1381,6 +1393,36 @@ export declare type KayAppAutomationMatch = {
|
|
|
1381
1393
|
readonly requestedBy?: "user" | "agent" | undefined;
|
|
1382
1394
|
};
|
|
1383
1395
|
|
|
1396
|
+
/**
|
|
1397
|
+
* One URI a run produced: every URI its successful `write` and `edit` calls
|
|
1398
|
+
* changed, every URI a tool declared it created or updated, and every row
|
|
1399
|
+
* {@link KayAppAutomationRunDetail.artifacts} and `externalResources` report,
|
|
1400
|
+
* deduplicated by URI. A session-scoped `output://` URI is one row per session.
|
|
1401
|
+
* `uri` is a `scheme://` URI, an absolute local file path, or an external
|
|
1402
|
+
* resource's canonical https URL.
|
|
1403
|
+
*/
|
|
1404
|
+
export declare interface KayAppAutomationProducedResourceItem {
|
|
1405
|
+
readonly uri: string;
|
|
1406
|
+
/** By precedence `deleted` > `created` > `updated`; only an artifact receipt reports `deleted`. */
|
|
1407
|
+
readonly action: "created" | "updated" | "deleted";
|
|
1408
|
+
/** The session that produced it, and the one a session-scoped URI resolves against. */
|
|
1409
|
+
readonly sessionId: string;
|
|
1410
|
+
/** A real revision the run recorded for this URI, and how many; absent when it recorded none. */
|
|
1411
|
+
readonly revision?: {
|
|
1412
|
+
readonly id: string;
|
|
1413
|
+
readonly count: number;
|
|
1414
|
+
} | undefined;
|
|
1415
|
+
readonly offBranch: boolean;
|
|
1416
|
+
readonly shared: boolean;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
/** Every URI one run produced, served whole: at most 1,000 rows, `truncated` when there were more. */
|
|
1420
|
+
export declare interface KayAppAutomationProducedResources {
|
|
1421
|
+
readonly items: readonly KayAppAutomationProducedResourceItem[];
|
|
1422
|
+
readonly totalCount: number;
|
|
1423
|
+
readonly truncated: boolean;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1384
1426
|
export declare interface KayAppAutomationRun {
|
|
1385
1427
|
readonly id: string;
|
|
1386
1428
|
readonly bindingId: string;
|
|
@@ -1421,6 +1463,8 @@ export declare interface KayAppAutomationRunDetail {
|
|
|
1421
1463
|
* because a pull request is something the run produced.
|
|
1422
1464
|
*/
|
|
1423
1465
|
readonly externalResources: KayAppProvenancePage<KayAppAutomationExternalResourceItem>;
|
|
1466
|
+
/** The one list of everything the run produced; it includes every row of the two lists above. */
|
|
1467
|
+
readonly producedResources: KayAppAutomationProducedResources;
|
|
1424
1468
|
readonly suggestions: KayAppProvenancePage<KayAppAutomationSuggestionItem>;
|
|
1425
1469
|
readonly coverage: KayAppAutomationRunCoverage;
|
|
1426
1470
|
}
|
|
@@ -2590,7 +2634,9 @@ export declare type KayAppProcessingSpeed = "standard" | "fast";
|
|
|
2590
2634
|
*/
|
|
2591
2635
|
export declare type KayAppProvenanceGapCode = "legacy-run-id-missing" | "mutation-revision-missing" | "partial-git-provenance" | "git-session-stamp-missing"
|
|
2592
2636
|
/** A run created something off this machine that the transcript cannot name. */
|
|
2593
|
-
| "external-resource-unnamed"
|
|
2637
|
+
| "external-resource-unnamed"
|
|
2638
|
+
/** A run's write or edit succeeded and the transcript cannot name the URI it changed. */
|
|
2639
|
+
| "produced-resource-unnamed" | "skill-suggestion-unattributable" | "malformed-source-record" | "source-unreadable" | "git-revision-unavailable" | "automation-history-unavailable" | "session-history-unavailable" | "required-evidence-missing";
|
|
2594
2640
|
|
|
2595
2641
|
/** One gap, with enum-specific bounded detail; never a raw payload. */
|
|
2596
2642
|
export declare interface KayAppProvenanceGapSummary {
|
|
@@ -2827,7 +2873,7 @@ export declare type KayAppSessionEventType = "human-message" | "turn-settled" |
|
|
|
2827
2873
|
|
|
2828
2874
|
export declare type KayAppSessionIntent = SessionIntent;
|
|
2829
2875
|
|
|
2830
|
-
export declare type KayAppSessionMode = "default" | "ask" | "allow";
|
|
2876
|
+
export declare type KayAppSessionMode = "default" | "ask" | "allow" | "auto";
|
|
2831
2877
|
|
|
2832
2878
|
export declare type KayAppSessionOrigin = {
|
|
2833
2879
|
readonly kind: "user";
|
|
@@ -4355,6 +4401,7 @@ declare const PluginAgentDefinitionPermissionRule: z.ZodObject<{
|
|
|
4355
4401
|
default: "default";
|
|
4356
4402
|
allow: "allow";
|
|
4357
4403
|
ask: "ask";
|
|
4404
|
+
auto: "auto";
|
|
4358
4405
|
}>>;
|
|
4359
4406
|
}, z.core.$strict>;
|
|
4360
4407
|
|