@osstack/protocol 0.10.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/dist/approval.d.ts +102 -0
- package/dist/approval.d.ts.map +1 -0
- package/dist/approval.js +52 -0
- package/dist/approval.js.map +1 -0
- package/dist/envelope.d.ts +882 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +210 -0
- package/dist/envelope.js.map +1 -0
- package/dist/event.d.ts +36 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +28 -0
- package/dist/event.js.map +1 -0
- package/dist/evidence.d.ts +51 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +34 -0
- package/dist/evidence.js.map +1 -0
- package/dist/generate.d.ts +16 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +60 -0
- package/dist/generate.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/policy.d.ts +284 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +58 -0
- package/dist/policy.js.map +1 -0
- package/dist/protocol.test.d.ts +2 -0
- package/dist/protocol.test.d.ts.map +1 -0
- package/dist/protocol.test.js +251 -0
- package/dist/protocol.test.js.map +1 -0
- package/dist/run.d.ts +34 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +25 -0
- package/dist/run.js.map +1 -0
- package/dist/schemas.test.d.ts +2 -0
- package/dist/schemas.test.d.ts.map +1 -0
- package/dist/schemas.test.js +34 -0
- package/dist/schemas.test.js.map +1 -0
- package/dist/task.d.ts +40 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +40 -0
- package/dist/task.js.map +1 -0
- package/dist/version.d.ts +11 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +18 -0
- package/dist/version.js.map +1 -0
- package/package.json +38 -0
- package/schemas/agent-command-result.schema.json +163 -0
- package/schemas/agent-command.schema.json +69 -0
- package/schemas/approval-decision.schema.json +49 -0
- package/schemas/approval-request.schema.json +38 -0
- package/schemas/event-envelope.schema.json +48 -0
- package/schemas/evidence-ref.schema.json +34 -0
- package/schemas/policy-decision.schema.json +166 -0
- package/schemas/run-summary.schema.json +50 -0
- package/schemas/task.schema.json +51 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const Actor: z.ZodObject<{
|
|
3
|
+
readonly type: z.ZodEnum<["human", "agent"]>;
|
|
4
|
+
readonly id: z.ZodString;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
type: "human" | "agent";
|
|
7
|
+
id: string;
|
|
8
|
+
}, {
|
|
9
|
+
type: "human" | "agent";
|
|
10
|
+
id: string;
|
|
11
|
+
}>;
|
|
12
|
+
export type Actor = z.infer<typeof Actor>;
|
|
13
|
+
/** Consumer-lenient Actor (A-007 deep leniency) — same shape, unknown fields ignored. */
|
|
14
|
+
export declare const ActorLenient: z.ZodObject<{
|
|
15
|
+
readonly type: z.ZodEnum<["human", "agent"]>;
|
|
16
|
+
readonly id: z.ZodString;
|
|
17
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
18
|
+
readonly type: z.ZodEnum<["human", "agent"]>;
|
|
19
|
+
readonly id: z.ZodString;
|
|
20
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
21
|
+
readonly type: z.ZodEnum<["human", "agent"]>;
|
|
22
|
+
readonly id: z.ZodString;
|
|
23
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
24
|
+
/** Risk band of an action requiring approval. */
|
|
25
|
+
export declare const Risk: z.ZodEnum<["low", "medium", "high"]>;
|
|
26
|
+
export type Risk = z.infer<typeof Risk>;
|
|
27
|
+
export declare const ApprovalRequest: z.ZodObject<{
|
|
28
|
+
readonly approval_id: z.ZodString;
|
|
29
|
+
readonly run_id: z.ZodOptional<z.ZodString>;
|
|
30
|
+
readonly action: z.ZodString;
|
|
31
|
+
readonly risk: z.ZodEnum<["low", "medium", "high"]>;
|
|
32
|
+
readonly requested_at: z.ZodString;
|
|
33
|
+
}, "strict", z.ZodTypeAny, {
|
|
34
|
+
approval_id: string;
|
|
35
|
+
action: string;
|
|
36
|
+
risk: "low" | "medium" | "high";
|
|
37
|
+
requested_at: string;
|
|
38
|
+
run_id?: string | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
approval_id: string;
|
|
41
|
+
action: string;
|
|
42
|
+
risk: "low" | "medium" | "high";
|
|
43
|
+
requested_at: string;
|
|
44
|
+
run_id?: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type ApprovalRequest = z.infer<typeof ApprovalRequest>;
|
|
47
|
+
/** Consumer-lenient ApprovalRequest (A-007 deep leniency). */
|
|
48
|
+
export declare const ApprovalRequestLenient: z.ZodObject<{
|
|
49
|
+
readonly approval_id: z.ZodString;
|
|
50
|
+
readonly run_id: z.ZodOptional<z.ZodString>;
|
|
51
|
+
readonly action: z.ZodString;
|
|
52
|
+
readonly risk: z.ZodEnum<["low", "medium", "high"]>;
|
|
53
|
+
readonly requested_at: z.ZodString;
|
|
54
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
55
|
+
readonly approval_id: z.ZodString;
|
|
56
|
+
readonly run_id: z.ZodOptional<z.ZodString>;
|
|
57
|
+
readonly action: z.ZodString;
|
|
58
|
+
readonly risk: z.ZodEnum<["low", "medium", "high"]>;
|
|
59
|
+
readonly requested_at: z.ZodString;
|
|
60
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
61
|
+
readonly approval_id: z.ZodString;
|
|
62
|
+
readonly run_id: z.ZodOptional<z.ZodString>;
|
|
63
|
+
readonly action: z.ZodString;
|
|
64
|
+
readonly risk: z.ZodEnum<["low", "medium", "high"]>;
|
|
65
|
+
readonly requested_at: z.ZodString;
|
|
66
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
67
|
+
export declare const ApprovalDecision: z.ZodObject<{
|
|
68
|
+
approval_id: z.ZodString;
|
|
69
|
+
approved: z.ZodBoolean;
|
|
70
|
+
decided_by: z.ZodObject<{
|
|
71
|
+
readonly type: z.ZodEnum<["human", "agent"]>;
|
|
72
|
+
readonly id: z.ZodString;
|
|
73
|
+
}, "strict", z.ZodTypeAny, {
|
|
74
|
+
type: "human" | "agent";
|
|
75
|
+
id: string;
|
|
76
|
+
}, {
|
|
77
|
+
type: "human" | "agent";
|
|
78
|
+
id: string;
|
|
79
|
+
}>;
|
|
80
|
+
decided_at: z.ZodString;
|
|
81
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, "strict", z.ZodTypeAny, {
|
|
83
|
+
approval_id: string;
|
|
84
|
+
approved: boolean;
|
|
85
|
+
decided_by: {
|
|
86
|
+
type: "human" | "agent";
|
|
87
|
+
id: string;
|
|
88
|
+
};
|
|
89
|
+
decided_at: string;
|
|
90
|
+
reason?: string | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
approval_id: string;
|
|
93
|
+
approved: boolean;
|
|
94
|
+
decided_by: {
|
|
95
|
+
type: "human" | "agent";
|
|
96
|
+
id: string;
|
|
97
|
+
};
|
|
98
|
+
decided_at: string;
|
|
99
|
+
reason?: string | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
export type ApprovalDecision = z.infer<typeof ApprovalDecision>;
|
|
102
|
+
//# sourceMappingURL=approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,KAAK;;;;;;;;;EAAgC,CAAC;AACnD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAE1C,yFAAyF;AACzF,eAAO,MAAM,YAAY;;;;;;;;;gCAAqC,CAAC;AAE/D,iDAAiD;AACjD,eAAO,MAAM,IAAI,sCAAoC,CAAC;AACtD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAUxC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAA0C,CAAC;AACvE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,8DAA8D;AAC9D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;gCAA+C,CAAC;AAEnF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQlB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/approval.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Approval shapes + the shared Actor identity.
|
|
2
|
+
//
|
|
3
|
+
// Extraction (architecture §1 / AGENT_COMMAND_PROTOCOL_V1 A-005): a minimal
|
|
4
|
+
// subset of core's ApprovalRow.
|
|
5
|
+
// ApprovalRequest: { approval_id, run_id?, action, risk, requested_at }
|
|
6
|
+
// ApprovalDecision: { approval_id, approved, decided_by, decided_at, reason? }
|
|
7
|
+
//
|
|
8
|
+
// Actor lives here (used by both ApprovalDecision.decided_by and the command
|
|
9
|
+
// envelope's `actor`) so the dependency stays one-way (envelope -> approval),
|
|
10
|
+
// avoiding a schema-init cycle.
|
|
11
|
+
//
|
|
12
|
+
// A-007 deep leniency: consumer-side parsers must ignore unknown fields at
|
|
13
|
+
// EVERY level, not just the envelope top level — a v1.1 producer may add an
|
|
14
|
+
// optional field inside a nested object (e.g. actor.display_name). Each nested
|
|
15
|
+
// shape used by the lenient envelope parsers therefore also exports an explicit
|
|
16
|
+
// `.passthrough()` variant; the producer schemas stay deep-strict.
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
/**
|
|
19
|
+
* A-005: `decided_by` is the FULL actor shape (type + id), never a bare id
|
|
20
|
+
* string, so the A-004 human-actor rule is structurally checkable — a decision
|
|
21
|
+
* whose `decided_by.type` is `agent` can be rejected at the policy layer unless
|
|
22
|
+
* the profile delegates that category (`allowed_auto_changes`).
|
|
23
|
+
*/
|
|
24
|
+
const actorShape = {
|
|
25
|
+
type: z.enum(["human", "agent"]),
|
|
26
|
+
id: z.string().min(1),
|
|
27
|
+
};
|
|
28
|
+
export const Actor = z.object(actorShape).strict();
|
|
29
|
+
/** Consumer-lenient Actor (A-007 deep leniency) — same shape, unknown fields ignored. */
|
|
30
|
+
export const ActorLenient = z.object(actorShape).passthrough();
|
|
31
|
+
/** Risk band of an action requiring approval. */
|
|
32
|
+
export const Risk = z.enum(["low", "medium", "high"]);
|
|
33
|
+
const approvalRequestShape = {
|
|
34
|
+
approval_id: z.string().min(1),
|
|
35
|
+
run_id: z.string().min(1).optional(),
|
|
36
|
+
action: z.string().min(1),
|
|
37
|
+
risk: Risk,
|
|
38
|
+
requested_at: z.string().datetime(),
|
|
39
|
+
};
|
|
40
|
+
export const ApprovalRequest = z.object(approvalRequestShape).strict();
|
|
41
|
+
/** Consumer-lenient ApprovalRequest (A-007 deep leniency). */
|
|
42
|
+
export const ApprovalRequestLenient = z.object(approvalRequestShape).passthrough();
|
|
43
|
+
export const ApprovalDecision = z
|
|
44
|
+
.object({
|
|
45
|
+
approval_id: z.string().min(1),
|
|
46
|
+
approved: z.boolean(),
|
|
47
|
+
decided_by: Actor,
|
|
48
|
+
decided_at: z.string().datetime(),
|
|
49
|
+
reason: z.string().optional(),
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
52
|
+
//# sourceMappingURL=approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval.js","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,4EAA4E;AAC5E,gCAAgC;AAChC,2EAA2E;AAC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