@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.
Files changed (58) hide show
  1. package/dist/approval.d.ts +102 -0
  2. package/dist/approval.d.ts.map +1 -0
  3. package/dist/approval.js +52 -0
  4. package/dist/approval.js.map +1 -0
  5. package/dist/envelope.d.ts +882 -0
  6. package/dist/envelope.d.ts.map +1 -0
  7. package/dist/envelope.js +210 -0
  8. package/dist/envelope.js.map +1 -0
  9. package/dist/event.d.ts +36 -0
  10. package/dist/event.d.ts.map +1 -0
  11. package/dist/event.js +28 -0
  12. package/dist/event.js.map +1 -0
  13. package/dist/evidence.d.ts +51 -0
  14. package/dist/evidence.d.ts.map +1 -0
  15. package/dist/evidence.js +34 -0
  16. package/dist/evidence.js.map +1 -0
  17. package/dist/generate.d.ts +16 -0
  18. package/dist/generate.d.ts.map +1 -0
  19. package/dist/generate.js +60 -0
  20. package/dist/generate.js.map +1 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +16 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/policy.d.ts +284 -0
  26. package/dist/policy.d.ts.map +1 -0
  27. package/dist/policy.js +58 -0
  28. package/dist/policy.js.map +1 -0
  29. package/dist/protocol.test.d.ts +2 -0
  30. package/dist/protocol.test.d.ts.map +1 -0
  31. package/dist/protocol.test.js +251 -0
  32. package/dist/protocol.test.js.map +1 -0
  33. package/dist/run.d.ts +34 -0
  34. package/dist/run.d.ts.map +1 -0
  35. package/dist/run.js +25 -0
  36. package/dist/run.js.map +1 -0
  37. package/dist/schemas.test.d.ts +2 -0
  38. package/dist/schemas.test.d.ts.map +1 -0
  39. package/dist/schemas.test.js +34 -0
  40. package/dist/schemas.test.js.map +1 -0
  41. package/dist/task.d.ts +40 -0
  42. package/dist/task.d.ts.map +1 -0
  43. package/dist/task.js +40 -0
  44. package/dist/task.js.map +1 -0
  45. package/dist/version.d.ts +11 -0
  46. package/dist/version.d.ts.map +1 -0
  47. package/dist/version.js +18 -0
  48. package/dist/version.js.map +1 -0
  49. package/package.json +38 -0
  50. package/schemas/agent-command-result.schema.json +163 -0
  51. package/schemas/agent-command.schema.json +69 -0
  52. package/schemas/approval-decision.schema.json +49 -0
  53. package/schemas/approval-request.schema.json +38 -0
  54. package/schemas/event-envelope.schema.json +48 -0
  55. package/schemas/evidence-ref.schema.json +34 -0
  56. package/schemas/policy-decision.schema.json +166 -0
  57. package/schemas/run-summary.schema.json +50 -0
  58. package/schemas/task.schema.json +51 -0
package/dist/run.js ADDED
@@ -0,0 +1,25 @@
1
+ // RunSummary — the shared, cross-process summary of an agent run.
2
+ //
3
+ // Extraction (architecture §1): the common denominator of the loop executor's
4
+ // `AgentRun` and the CLI's `insertRun`. Persistence-only columns (session_id,
5
+ // capability_id, phase, token counts, retry/intervention counts, gbrain/hermes
6
+ // ids, last_step) stay in core's RunRow and are NOT part of the protocol v1.
7
+ //
8
+ // Timestamps use ISO-8601 strings (the loop AgentRun form), which is the
9
+ // human/agent-facing cross-process representation; core persists epoch numbers.
10
+ import { z } from "zod";
11
+ /** Terminal outcome of a run (common denominator of executor AgentRun outcomes). */
12
+ export const RunOutcome = z.enum(["completed", "failed", "cancelled"]);
13
+ export const RunSummary = z
14
+ .object({
15
+ run_id: z.string().min(1),
16
+ task_id: z.string().min(1),
17
+ agent_id: z.string().min(1),
18
+ outcome: RunOutcome,
19
+ started_at: z.string().datetime(),
20
+ completed_at: z.string().datetime().optional(),
21
+ duration_ms: z.number().int().nonnegative().optional(),
22
+ summary: z.string().optional(),
23
+ })
24
+ .strict();
25
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,EAAE;AACF,yEAAyE;AACzE,gFAAgF;AAEhF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oFAAoF;AACpF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAGvE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACtD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schemas.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.test.d.ts","sourceRoot":"","sources":["../src/schemas.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ // Schema-generation drift guard: the committed schemas/*.schema.json MUST equal
2
+ // what the Zod source of truth produces right now. Regenerating produces zero
3
+ // diff — the same generateAll() runs here (against src) and in
4
+ // scripts/generate-schemas.mjs (against dist).
5
+ import { existsSync, readFileSync } from "node:fs";
6
+ import { fileURLToPath } from "node:url";
7
+ import { describe, expect, it } from "vitest";
8
+ import { generateAll } from "./generate.js";
9
+ const SCHEMAS_DIR = fileURLToPath(new URL("../schemas", import.meta.url));
10
+ describe("generated JSON Schemas are committed and fresh", () => {
11
+ const expected = generateAll();
12
+ const filenames = Object.keys(expected).sort();
13
+ it("emits one schema per public protocol contract", () => {
14
+ expect(filenames).toEqual([
15
+ "agent-command-result.schema.json",
16
+ "agent-command.schema.json",
17
+ "approval-decision.schema.json",
18
+ "approval-request.schema.json",
19
+ "event-envelope.schema.json",
20
+ "evidence-ref.schema.json",
21
+ "policy-decision.schema.json",
22
+ "run-summary.schema.json",
23
+ "task.schema.json",
24
+ ].sort());
25
+ });
26
+ for (const filename of filenames) {
27
+ it(`schemas/${filename} matches the Zod source (zero drift)`, () => {
28
+ const path = `${SCHEMAS_DIR}/${filename}`;
29
+ expect(existsSync(path), `schemas/${filename} is not committed — run generate:schemas`).toBe(true);
30
+ expect(readFileSync(path, "utf-8")).toBe(expected[filename]);
31
+ });
32
+ }
33
+ });
34
+ //# sourceMappingURL=schemas.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.test.js","sourceRoot":"","sources":["../src/schemas.test.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8EAA8E;AAC9E,+DAA+D;AAC/D,+CAA+C;AAE/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1E,QAAQ,CAAC,gDAAgD,EAAE,GAAG,EAAE;IAC9D,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAE/C,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CACvB;YACE,kCAAkC;YAClC,2BAA2B;YAC3B,+BAA+B;YAC/B,8BAA8B;YAC9B,4BAA4B;YAC5B,0BAA0B;YAC1B,6BAA6B;YAC7B,yBAAyB;YACzB,kBAAkB;SACnB,CAAC,IAAI,EAAE,CACT,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,EAAE,CAAC,WAAW,QAAQ,sCAAsC,EAAE,GAAG,EAAE;YACjE,MAAM,IAAI,GAAG,GAAG,WAAW,IAAI,QAAQ,EAAE,CAAC;YAC1C,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,WAAW,QAAQ,0CAA0C,CAAC,CAAC,IAAI,CAC1F,IAAI,CACL,CAAC;YACF,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
package/dist/task.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { z } from "zod";
2
+ /** Where a task was discovered. Mirrors the loop DiscoverSource enum. */
3
+ export declare const TaskSource: z.ZodEnum<["git_diff", "gh_issue", "github_branch", "ci_log", "task_queue", "manual"]>;
4
+ export type TaskSource = z.infer<typeof TaskSource>;
5
+ export declare const Task: z.ZodObject<{
6
+ task_id: z.ZodString;
7
+ /** Capability kind needed, e.g. "code.fix", "review.code". */
8
+ capability: z.ZodString;
9
+ /** Natural-language prompt the agent will receive. */
10
+ prompt: z.ZodString;
11
+ source: z.ZodEnum<["git_diff", "gh_issue", "github_branch", "ci_log", "task_queue", "manual"]>;
12
+ /** Optional-with-default, 0–100 (mirrors the loop Task default of 50). */
13
+ priority: z.ZodDefault<z.ZodNumber>;
14
+ /** Optional structured context (file paths, line ranges, error messages). */
15
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
+ /**
17
+ * First-class evaluation harness specs. In v1 this stays an opaque array:
18
+ * loop's EvaluationSpec details are deliberately NOT imported/pre-packaged
19
+ * (owner constraint — no internal type leakage until a second consumer exists).
20
+ */
21
+ evaluation: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
22
+ }, "strict", z.ZodTypeAny, {
23
+ task_id: string;
24
+ capability: string;
25
+ prompt: string;
26
+ source: "git_diff" | "gh_issue" | "github_branch" | "ci_log" | "task_queue" | "manual";
27
+ priority: number;
28
+ context?: Record<string, unknown> | undefined;
29
+ evaluation?: unknown[] | undefined;
30
+ }, {
31
+ task_id: string;
32
+ capability: string;
33
+ prompt: string;
34
+ source: "git_diff" | "gh_issue" | "github_branch" | "ci_log" | "task_queue" | "manual";
35
+ priority?: number | undefined;
36
+ context?: Record<string, unknown> | undefined;
37
+ evaluation?: unknown[] | undefined;
38
+ }>;
39
+ export type Task = z.infer<typeof Task>;
40
+ //# sourceMappingURL=task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yEAAyE;AACzE,eAAO,MAAM,UAAU,wFAOrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,IAAI;;IAGb,8DAA8D;;IAE9D,sDAAsD;;;IAGtD,0EAA0E;;IAE1E,6EAA6E;;IAE7E;;;;OAIG;;;;;;;;;;;;;;;;;;EAGI,CAAC;AACZ,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC"}
package/dist/task.js ADDED
@@ -0,0 +1,40 @@
1
+ // Task — the canonical cross-process unit of work.
2
+ //
3
+ // Extraction (architecture §1): the loop file-queue / daemon-RPC Task IS the
4
+ // cross-process shape today, so the protocol adopts it. It is defined
5
+ // INDEPENDENTLY here — protocol is the bottom layer and MUST NOT import
6
+ // @osstack/loop (owner constraint). Required fields mirror
7
+ // docs/specs/schemas/task.schema.json exactly: task_id, capability, prompt, source.
8
+ //
9
+ // core's TaskRow is a persistence projection, NOT this protocol shape.
10
+ import { z } from "zod";
11
+ /** Where a task was discovered. Mirrors the loop DiscoverSource enum. */
12
+ export const TaskSource = z.enum([
13
+ "git_diff",
14
+ "gh_issue",
15
+ "github_branch",
16
+ "ci_log",
17
+ "task_queue",
18
+ "manual",
19
+ ]);
20
+ export const Task = z
21
+ .object({
22
+ task_id: z.string().min(1),
23
+ /** Capability kind needed, e.g. "code.fix", "review.code". */
24
+ capability: z.string().min(1),
25
+ /** Natural-language prompt the agent will receive. */
26
+ prompt: z.string().min(1),
27
+ source: TaskSource,
28
+ /** Optional-with-default, 0–100 (mirrors the loop Task default of 50). */
29
+ priority: z.number().min(0).max(100).default(50),
30
+ /** Optional structured context (file paths, line ranges, error messages). */
31
+ context: z.record(z.unknown()).optional(),
32
+ /**
33
+ * First-class evaluation harness specs. In v1 this stays an opaque array:
34
+ * loop's EvaluationSpec details are deliberately NOT imported/pre-packaged
35
+ * (owner constraint — no internal type leakage until a second consumer exists).
36
+ */
37
+ evaluation: z.array(z.unknown()).optional(),
38
+ })
39
+ .strict();
40
+ //# sourceMappingURL=task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.js","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AACtE,wEAAwE;AACxE,2DAA2D;AAC3D,oFAAoF;AACpF,EAAE;AACF,uEAAuE;AAEvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yEAAyE;AACzE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC;IAC/B,UAAU;IACV,UAAU;IACV,eAAe;IACf,QAAQ;IACR,YAAY;IACZ,QAAQ;CACT,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,8DAA8D;IAC9D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,sDAAsD;IACtD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,MAAM,EAAE,UAAU;IAClB,0EAA0E;IAC1E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAChD,6EAA6E;IAC7E,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IACzC;;;;OAIG;IACH,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC5C,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ /** The protocol version this package produces. Bumped on every published change. */
3
+ export declare const PROTOCOL_VERSION: "1.0";
4
+ /**
5
+ * Accepts any minor of protocol major 1 (`1.0`, `1.1`, …), matching the
6
+ * `^1\.[0-9]+$` pattern in the spec JSON Schemas. A consumer on 1.0 therefore
7
+ * accepts a 1.1 producer's version string (forward compatible within the major).
8
+ */
9
+ export declare const ProtocolVersion: z.ZodString;
10
+ export type ProtocolVersion = z.infer<typeof ProtocolVersion>;
11
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oFAAoF;AACpF,eAAO,MAAM,gBAAgB,EAAG,KAAc,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAE1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ // Protocol version — the single source of truth for the wire protocol major/minor.
2
+ //
3
+ // PROTOCOL_VERSION is the version THIS package emits. Per AGENT_COMMAND_PROTOCOL_V1
4
+ // (A-007), envelopes carry a `protocol_version` string matched by `ProtocolVersion`.
5
+ // A breaking change is a new MAJOR + a new frozen fixture corpus; minor additions
6
+ // (new optional fields/commands/error codes) stay backward compatible.
7
+ import { z } from "zod";
8
+ /** The protocol version this package produces. Bumped on every published change. */
9
+ export const PROTOCOL_VERSION = "1.0";
10
+ /**
11
+ * Accepts any minor of protocol major 1 (`1.0`, `1.1`, …), matching the
12
+ * `^1\.[0-9]+$` pattern in the spec JSON Schemas. A consumer on 1.0 therefore
13
+ * accepts a 1.1 producer's version string (forward compatible within the major).
14
+ */
15
+ export const ProtocolVersion = z.string().regex(/^1\.[0-9]+$/, {
16
+ message: "protocol_version must match ^1.[0-9]+$ (protocol major 1)",
17
+ });
18
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,oFAAoF;AACpF,qFAAqF;AACrF,kFAAkF;AAClF,uEAAuE;AAEvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oFAAoF;AACpF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAc,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE;IAC7D,OAAO,EAAE,2DAA2D;CACrE,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@osstack/protocol",
3
+ "version": "0.10.0",
4
+ "description": "Stable cross-product / cross-process / cross-agent kernel contracts for osstack (Task, Run, Event, Evidence, Approval, Policy, Agent command envelope) with JSON Schema artifacts and a versioned protocol.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "schemas"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc -p .",
15
+ "test": "vitest run",
16
+ "typecheck": "tsc --noEmit",
17
+ "generate:schemas": "node scripts/generate-schemas.mjs",
18
+ "check:schemas": "node scripts/generate-schemas.mjs --check"
19
+ },
20
+ "dependencies": {
21
+ "zod": "^3.25.76"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^22.19.19",
25
+ "zod-to-json-schema": "^3.25.2"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/gilosbornhello/osstack.git",
33
+ "directory": "packages/protocol"
34
+ },
35
+ "engines": {
36
+ "node": ">=20"
37
+ }
38
+ }
@@ -0,0 +1,163 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Osstack Protocol Agent Command Result",
4
+ "$comment": "Conditional rules (A-003 status<->code mapping, A-006 retryable constraint) are enforced by @osstack/protocol superRefine and are NOT expressible in this JSON Schema; see AGENT_COMMAND_PROTOCOL_V1.md.",
5
+ "type": "object",
6
+ "properties": {
7
+ "protocol_version": {
8
+ "type": "string",
9
+ "pattern": "^1\\.[0-9]+$"
10
+ },
11
+ "status": {
12
+ "type": "string",
13
+ "enum": [
14
+ "ok",
15
+ "needs_approval",
16
+ "blocked",
17
+ "error"
18
+ ]
19
+ },
20
+ "result": {
21
+ "type": "object",
22
+ "additionalProperties": {}
23
+ },
24
+ "evidence_refs": {
25
+ "type": "array",
26
+ "items": {
27
+ "type": "object",
28
+ "properties": {
29
+ "kind": {
30
+ "type": "string",
31
+ "enum": [
32
+ "report",
33
+ "scorecard",
34
+ "proof",
35
+ "loop_state",
36
+ "external"
37
+ ]
38
+ },
39
+ "ref": {
40
+ "type": "string",
41
+ "minLength": 1
42
+ },
43
+ "sha256": {
44
+ "type": "string",
45
+ "pattern": "^[a-f0-9]{64}$"
46
+ },
47
+ "run_id": {
48
+ "type": "string",
49
+ "minLength": 1
50
+ }
51
+ },
52
+ "required": [
53
+ "kind",
54
+ "ref"
55
+ ],
56
+ "additionalProperties": false
57
+ }
58
+ },
59
+ "required_approvals": {
60
+ "type": "array",
61
+ "items": {
62
+ "type": "object",
63
+ "properties": {
64
+ "approval_id": {
65
+ "type": "string",
66
+ "minLength": 1
67
+ },
68
+ "run_id": {
69
+ "type": "string",
70
+ "minLength": 1
71
+ },
72
+ "action": {
73
+ "type": "string",
74
+ "minLength": 1
75
+ },
76
+ "risk": {
77
+ "type": "string",
78
+ "enum": [
79
+ "low",
80
+ "medium",
81
+ "high"
82
+ ]
83
+ },
84
+ "requested_at": {
85
+ "type": "string",
86
+ "format": "date-time"
87
+ }
88
+ },
89
+ "required": [
90
+ "approval_id",
91
+ "action",
92
+ "risk",
93
+ "requested_at"
94
+ ],
95
+ "additionalProperties": false
96
+ }
97
+ },
98
+ "next_actions": {
99
+ "type": "array",
100
+ "items": {
101
+ "type": "object",
102
+ "properties": {
103
+ "command": {
104
+ "type": "string",
105
+ "pattern": "^[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*$"
106
+ },
107
+ "reason": {
108
+ "type": "string",
109
+ "minLength": 1
110
+ }
111
+ },
112
+ "required": [
113
+ "command",
114
+ "reason"
115
+ ],
116
+ "additionalProperties": false
117
+ }
118
+ },
119
+ "error": {
120
+ "anyOf": [
121
+ {
122
+ "type": "object",
123
+ "properties": {
124
+ "code": {
125
+ "type": "string",
126
+ "enum": [
127
+ "bad_request",
128
+ "unsupported_protocol_version",
129
+ "unknown_command",
130
+ "policy_denied",
131
+ "not_found",
132
+ "conflict",
133
+ "budget_exceeded",
134
+ "internal"
135
+ ]
136
+ },
137
+ "message": {
138
+ "type": "string",
139
+ "minLength": 1
140
+ },
141
+ "retryable": {
142
+ "type": "boolean"
143
+ }
144
+ },
145
+ "required": [
146
+ "code",
147
+ "message",
148
+ "retryable"
149
+ ],
150
+ "additionalProperties": false
151
+ },
152
+ {
153
+ "type": "null"
154
+ }
155
+ ]
156
+ }
157
+ },
158
+ "required": [
159
+ "protocol_version",
160
+ "status"
161
+ ],
162
+ "additionalProperties": false
163
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Osstack Protocol Agent Command",
4
+ "type": "object",
5
+ "properties": {
6
+ "protocol_version": {
7
+ "type": "string",
8
+ "pattern": "^1\\.[0-9]+$"
9
+ },
10
+ "command": {
11
+ "type": "string",
12
+ "pattern": "^[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*$"
13
+ },
14
+ "actor": {
15
+ "type": "object",
16
+ "properties": {
17
+ "type": {
18
+ "type": "string",
19
+ "enum": [
20
+ "human",
21
+ "agent"
22
+ ]
23
+ },
24
+ "id": {
25
+ "type": "string",
26
+ "minLength": 1
27
+ }
28
+ },
29
+ "required": [
30
+ "type",
31
+ "id"
32
+ ],
33
+ "additionalProperties": false
34
+ },
35
+ "scope": {
36
+ "type": "object",
37
+ "properties": {
38
+ "portfolio_id": {
39
+ "type": "string",
40
+ "minLength": 1
41
+ },
42
+ "repo_id": {
43
+ "type": "string",
44
+ "minLength": 1
45
+ }
46
+ },
47
+ "additionalProperties": false
48
+ },
49
+ "input": {
50
+ "type": "object",
51
+ "additionalProperties": {}
52
+ },
53
+ "policy_profile": {
54
+ "type": "string",
55
+ "minLength": 1
56
+ },
57
+ "idempotency_key": {
58
+ "type": "string",
59
+ "minLength": 1
60
+ }
61
+ },
62
+ "required": [
63
+ "protocol_version",
64
+ "command",
65
+ "actor",
66
+ "input"
67
+ ],
68
+ "additionalProperties": false
69
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Osstack Protocol Approval Decision",
4
+ "type": "object",
5
+ "properties": {
6
+ "approval_id": {
7
+ "type": "string",
8
+ "minLength": 1
9
+ },
10
+ "approved": {
11
+ "type": "boolean"
12
+ },
13
+ "decided_by": {
14
+ "type": "object",
15
+ "properties": {
16
+ "type": {
17
+ "type": "string",
18
+ "enum": [
19
+ "human",
20
+ "agent"
21
+ ]
22
+ },
23
+ "id": {
24
+ "type": "string",
25
+ "minLength": 1
26
+ }
27
+ },
28
+ "required": [
29
+ "type",
30
+ "id"
31
+ ],
32
+ "additionalProperties": false
33
+ },
34
+ "decided_at": {
35
+ "type": "string",
36
+ "format": "date-time"
37
+ },
38
+ "reason": {
39
+ "type": "string"
40
+ }
41
+ },
42
+ "required": [
43
+ "approval_id",
44
+ "approved",
45
+ "decided_by",
46
+ "decided_at"
47
+ ],
48
+ "additionalProperties": false
49
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Osstack Protocol Approval Request",
4
+ "type": "object",
5
+ "properties": {
6
+ "approval_id": {
7
+ "type": "string",
8
+ "minLength": 1
9
+ },
10
+ "run_id": {
11
+ "type": "string",
12
+ "minLength": 1
13
+ },
14
+ "action": {
15
+ "type": "string",
16
+ "minLength": 1
17
+ },
18
+ "risk": {
19
+ "type": "string",
20
+ "enum": [
21
+ "low",
22
+ "medium",
23
+ "high"
24
+ ]
25
+ },
26
+ "requested_at": {
27
+ "type": "string",
28
+ "format": "date-time"
29
+ }
30
+ },
31
+ "required": [
32
+ "approval_id",
33
+ "action",
34
+ "risk",
35
+ "requested_at"
36
+ ],
37
+ "additionalProperties": false
38
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Osstack Protocol Event Envelope",
4
+ "type": "object",
5
+ "properties": {
6
+ "event_id": {
7
+ "type": "string",
8
+ "minLength": 1
9
+ },
10
+ "seq": {
11
+ "type": "integer",
12
+ "minimum": 0
13
+ },
14
+ "run_id": {
15
+ "type": "string",
16
+ "minLength": 1
17
+ },
18
+ "session_id": {
19
+ "type": "string",
20
+ "minLength": 1
21
+ },
22
+ "created_at": {
23
+ "type": "number"
24
+ },
25
+ "terminal": {
26
+ "type": "boolean",
27
+ "default": false
28
+ },
29
+ "type": {
30
+ "type": "string",
31
+ "minLength": 1
32
+ },
33
+ "payload": {
34
+ "type": "object",
35
+ "additionalProperties": {}
36
+ }
37
+ },
38
+ "required": [
39
+ "event_id",
40
+ "seq",
41
+ "run_id",
42
+ "session_id",
43
+ "created_at",
44
+ "type",
45
+ "payload"
46
+ ],
47
+ "additionalProperties": false
48
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Osstack Protocol Evidence Ref",
4
+ "type": "object",
5
+ "properties": {
6
+ "kind": {
7
+ "type": "string",
8
+ "enum": [
9
+ "report",
10
+ "scorecard",
11
+ "proof",
12
+ "loop_state",
13
+ "external"
14
+ ]
15
+ },
16
+ "ref": {
17
+ "type": "string",
18
+ "minLength": 1
19
+ },
20
+ "sha256": {
21
+ "type": "string",
22
+ "pattern": "^[a-f0-9]{64}$"
23
+ },
24
+ "run_id": {
25
+ "type": "string",
26
+ "minLength": 1
27
+ }
28
+ },
29
+ "required": [
30
+ "kind",
31
+ "ref"
32
+ ],
33
+ "additionalProperties": false
34
+ }