gateproof 0.2.2 → 0.2.4

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 (62) hide show
  1. package/README.md +132 -350
  2. package/dist/act.d.ts +45 -0
  3. package/dist/act.d.ts.map +1 -1
  4. package/dist/act.js +22 -0
  5. package/dist/act.js.map +1 -1
  6. package/dist/action-executors.d.ts +17 -0
  7. package/dist/action-executors.d.ts.map +1 -1
  8. package/dist/action-executors.js +60 -0
  9. package/dist/action-executors.js.map +1 -1
  10. package/dist/assert.d.ts +20 -0
  11. package/dist/assert.d.ts.map +1 -1
  12. package/dist/assert.js +32 -0
  13. package/dist/assert.js.map +1 -1
  14. package/dist/authority.d.ts +34 -0
  15. package/dist/authority.d.ts.map +1 -0
  16. package/dist/authority.js +141 -0
  17. package/dist/authority.js.map +1 -0
  18. package/dist/cli/gateproof.js +76 -0
  19. package/dist/cli/gateproof.js.map +1 -1
  20. package/dist/filepath-backend.d.ts +64 -0
  21. package/dist/filepath-backend.d.ts.map +1 -0
  22. package/dist/filepath-backend.js +126 -0
  23. package/dist/filepath-backend.js.map +1 -0
  24. package/dist/filepath-protocol.d.ts +214 -0
  25. package/dist/filepath-protocol.d.ts.map +1 -0
  26. package/dist/filepath-protocol.js +239 -0
  27. package/dist/filepath-protocol.js.map +1 -0
  28. package/dist/filepath-runtime.d.ts +100 -0
  29. package/dist/filepath-runtime.d.ts.map +1 -0
  30. package/dist/filepath-runtime.js +190 -0
  31. package/dist/filepath-runtime.js.map +1 -0
  32. package/dist/http-backend.d.ts +9 -0
  33. package/dist/http-backend.d.ts.map +1 -1
  34. package/dist/http-backend.js +50 -8
  35. package/dist/http-backend.js.map +1 -1
  36. package/dist/index.d.ts +11 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +9 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/prd/index.d.ts +2 -0
  41. package/dist/prd/index.d.ts.map +1 -1
  42. package/dist/prd/index.js +4 -0
  43. package/dist/prd/index.js.map +1 -1
  44. package/dist/prd/loop.d.ts +160 -0
  45. package/dist/prd/loop.d.ts.map +1 -0
  46. package/dist/prd/loop.js +462 -0
  47. package/dist/prd/loop.js.map +1 -0
  48. package/dist/prd/runner.d.ts +2 -5
  49. package/dist/prd/runner.d.ts.map +1 -1
  50. package/dist/prd/runner.js +154 -122
  51. package/dist/prd/runner.js.map +1 -1
  52. package/dist/prd/scope-defaults.d.ts +75 -0
  53. package/dist/prd/scope-defaults.d.ts.map +1 -0
  54. package/dist/prd/scope-defaults.js +235 -0
  55. package/dist/prd/scope-defaults.js.map +1 -0
  56. package/dist/prd/types.d.ts +79 -0
  57. package/dist/prd/types.d.ts.map +1 -1
  58. package/dist/report.d.ts +70 -0
  59. package/dist/report.d.ts.map +1 -1
  60. package/dist/report.js +183 -0
  61. package/dist/report.js.map +1 -1
  62. package/package.json +10 -2
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Filepath Backend — ObserveResource implementation for Filepath containers
3
+ *
4
+ * Creates an observe resource that reads NDJSON events from a Filepath
5
+ * agent container's stdout and maps them to Gateproof Log entries.
6
+ *
7
+ * This is the bridge: Filepath's agent protocol becomes observable
8
+ * evidence for gate assertions.
9
+ */
10
+ import type { AgentActConfig } from "./act";
11
+ import { type Backend, type ObserveResource } from "./observe";
12
+ import { type AgentEvent } from "./filepath-protocol";
13
+ /**
14
+ * Interface for a Filepath container connection.
15
+ * Implemented by real container runtimes or test mocks.
16
+ */
17
+ export interface FilepathContainer {
18
+ /** NDJSON line stream from the container's stdout */
19
+ stdout: AsyncIterable<string>;
20
+ /** Send an NDJSON message to the container's stdin */
21
+ sendInput(line: string): Promise<void>;
22
+ /** Stop the container */
23
+ stop(): Promise<void>;
24
+ }
25
+ /**
26
+ * Interface for spawning Filepath containers.
27
+ * Swap implementations for real containers vs test mocks.
28
+ */
29
+ export interface FilepathRuntime {
30
+ spawn(config: AgentActConfig): Promise<FilepathContainer>;
31
+ }
32
+ /**
33
+ * Creates a Backend that reads NDJSON events from a Filepath container
34
+ * and emits them as Gateproof Log entries.
35
+ */
36
+ export declare function createFilepathBackend(container: FilepathContainer, agentName?: string): Backend;
37
+ /**
38
+ * Creates an ObserveResource backed by a Filepath container.
39
+ *
40
+ * Usage:
41
+ * ```ts
42
+ * const container = await runtime.spawn(config);
43
+ * const observe = createFilepathObserveResource(container, "my-agent");
44
+ *
45
+ * const result = await Gate.run({
46
+ * observe,
47
+ * act: [Act.wait(1000)],
48
+ * assert: [Assert.hasAction("commit")],
49
+ * });
50
+ * ```
51
+ */
52
+ export declare function createFilepathObserveResource(container: FilepathContainer, agentName?: string): ObserveResource;
53
+ /**
54
+ * Creates a mock Filepath container for testing.
55
+ *
56
+ * Feed it NDJSON events and it emits them as if they came from a real container.
57
+ * Use `container.emit(event)` to push events, `container.done()` to signal completion.
58
+ */
59
+ export declare function createMockFilepathContainer(): FilepathContainer & {
60
+ emit(event: AgentEvent): void;
61
+ emitRaw(line: string): void;
62
+ done(): void;
63
+ };
64
+ //# sourceMappingURL=filepath-backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filepath-backend.d.ts","sourceRoot":"","sources":["../src/filepath-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAyB,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACtF,OAAO,EAAoD,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAExG;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9B,sDAAsD;IACtD,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,yBAAyB;IACzB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC3D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,iBAAiB,EAC5B,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAwBT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,iBAAiB,EAC5B,SAAS,CAAC,EAAE,MAAM,GACjB,eAAe,CAEjB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,IAAI,iBAAiB,GAAG;IACjE,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,IAAI,IAAI,CAAC;CACd,CA4DA"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Filepath Backend — ObserveResource implementation for Filepath containers
3
+ *
4
+ * Creates an observe resource that reads NDJSON events from a Filepath
5
+ * agent container's stdout and maps them to Gateproof Log entries.
6
+ *
7
+ * This is the bridge: Filepath's agent protocol becomes observable
8
+ * evidence for gate assertions.
9
+ */
10
+ import { Effect } from "effect";
11
+ import { createObserveResource } from "./observe";
12
+ import { agentEventToLog, parseAgentEvent } from "./filepath-protocol";
13
+ /**
14
+ * Creates a Backend that reads NDJSON events from a Filepath container
15
+ * and emits them as Gateproof Log entries.
16
+ */
17
+ export function createFilepathBackend(container, agentName) {
18
+ return {
19
+ start() {
20
+ return Effect.succeed({
21
+ async *[Symbol.asyncIterator]() {
22
+ for await (const line of container.stdout) {
23
+ const trimmed = line.trim();
24
+ if (!trimmed)
25
+ continue;
26
+ const event = parseAgentEvent(trimmed);
27
+ if (!event)
28
+ continue;
29
+ yield agentEventToLog(event, agentName);
30
+ }
31
+ },
32
+ });
33
+ },
34
+ stop() {
35
+ return Effect.tryPromise({
36
+ try: () => container.stop(),
37
+ catch: () => undefined,
38
+ }).pipe(Effect.catchAll(() => Effect.void));
39
+ },
40
+ };
41
+ }
42
+ /**
43
+ * Creates an ObserveResource backed by a Filepath container.
44
+ *
45
+ * Usage:
46
+ * ```ts
47
+ * const container = await runtime.spawn(config);
48
+ * const observe = createFilepathObserveResource(container, "my-agent");
49
+ *
50
+ * const result = await Gate.run({
51
+ * observe,
52
+ * act: [Act.wait(1000)],
53
+ * assert: [Assert.hasAction("commit")],
54
+ * });
55
+ * ```
56
+ */
57
+ export function createFilepathObserveResource(container, agentName) {
58
+ return createObserveResource(createFilepathBackend(container, agentName));
59
+ }
60
+ /**
61
+ * Creates a mock Filepath container for testing.
62
+ *
63
+ * Feed it NDJSON events and it emits them as if they came from a real container.
64
+ * Use `container.emit(event)` to push events, `container.done()` to signal completion.
65
+ */
66
+ export function createMockFilepathContainer() {
67
+ const lines = [];
68
+ let resolve = null;
69
+ let isDone = false;
70
+ const waitForLine = () => new Promise((r) => {
71
+ resolve = r;
72
+ });
73
+ return {
74
+ emit(event) {
75
+ lines.push(JSON.stringify(event));
76
+ if (resolve) {
77
+ const r = resolve;
78
+ resolve = null;
79
+ r();
80
+ }
81
+ },
82
+ emitRaw(line) {
83
+ lines.push(line);
84
+ if (resolve) {
85
+ const r = resolve;
86
+ resolve = null;
87
+ r();
88
+ }
89
+ },
90
+ done() {
91
+ isDone = true;
92
+ if (resolve) {
93
+ const r = resolve;
94
+ resolve = null;
95
+ r();
96
+ }
97
+ },
98
+ stdout: {
99
+ async *[Symbol.asyncIterator]() {
100
+ while (true) {
101
+ if (lines.length > 0) {
102
+ yield lines.shift();
103
+ }
104
+ else if (isDone) {
105
+ return;
106
+ }
107
+ else {
108
+ await waitForLine();
109
+ }
110
+ }
111
+ },
112
+ },
113
+ async sendInput(line) {
114
+ // Mock: just collect input, no real stdin
115
+ },
116
+ async stop() {
117
+ isDone = true;
118
+ if (resolve) {
119
+ const r = resolve;
120
+ resolve = null;
121
+ r();
122
+ }
123
+ },
124
+ };
125
+ }
126
+ //# sourceMappingURL=filepath-backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filepath-backend.js","sourceRoot":"","sources":["../src/filepath-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAGhD,OAAO,EAAE,qBAAqB,EAAsC,MAAM,WAAW,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAmC,MAAM,qBAAqB,CAAC;AAuBxG;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,SAA4B,EAC5B,SAAkB;IAElB,OAAO;QACL,KAAK;YACH,OAAO,MAAM,CAAC,OAAO,CAAqB;gBACxC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;oBAC3B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;wBAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;wBAC5B,IAAI,CAAC,OAAO;4BAAE,SAAS;wBAEvB,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;wBACvC,IAAI,CAAC,KAAK;4BAAE,SAAS;wBAErB,MAAM,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;oBAC1C,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QACD,IAAI;YACF,OAAO,MAAM,CAAC,UAAU,CAAC;gBACvB,GAAG,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE;gBAC3B,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;aACvB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,6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wBACrB,MAAM,KAAK,CAAC,KAAK,EAAG,CAAC;oBACvB,CAAC;yBAAM,IAAI,MAAM,EAAE,CAAC;wBAClB,OAAO;oBACT,CAAC;yBAAM,CAAC;wBACN,MAAM,WAAW,EAAE,CAAC;oBACtB,CAAC;gBACH,CAAC;YACH,CAAC;SACF;QACD,KAAK,CAAC,SAAS,CAAC,IAAY;YAC1B,0CAA0C;QAC5C,CAAC;QACD,KAAK,CAAC,IAAI;YACR,MAAM,GAAG,IAAI,CAAC;YACd,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,CAAC,GAAG,OAAO,CAAC;gBAClB,OAAO,GAAG,IAAI,CAAC;gBACf,CAAC,EAAE,CAAC;YACN,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Filepath Agent Protocol (FAP) — Gateproof integration
3
+ *
4
+ * Zod schemas for the NDJSON event stream between Filepath containers
5
+ * and the Gateproof observe layer. Each agent emits structured events
6
+ * on stdout; we parse and map them to Log entries for gate assertions.
7
+ *
8
+ * Protocol source: https://github.com/ACoyfellow/filepath
9
+ */
10
+ import { z } from "zod";
11
+ import type { Log } from "./types";
12
+ export declare const AgentStatus: z.ZodEnum<{
13
+ error: "error";
14
+ idle: "idle";
15
+ thinking: "thinking";
16
+ running: "running";
17
+ done: "done";
18
+ }>;
19
+ export type AgentStatus = z.infer<typeof AgentStatus>;
20
+ export declare const TextEvent: z.ZodObject<{
21
+ type: z.ZodLiteral<"text">;
22
+ content: z.ZodString;
23
+ }, z.core.$strip>;
24
+ export type TextEvent = z.infer<typeof TextEvent>;
25
+ export declare const ToolEvent: z.ZodObject<{
26
+ type: z.ZodLiteral<"tool">;
27
+ name: z.ZodString;
28
+ path: z.ZodOptional<z.ZodString>;
29
+ status: z.ZodEnum<{
30
+ start: "start";
31
+ error: "error";
32
+ done: "done";
33
+ }>;
34
+ output: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ export type ToolEvent = z.infer<typeof ToolEvent>;
37
+ export declare const CommandEvent: z.ZodObject<{
38
+ type: z.ZodLiteral<"command">;
39
+ cmd: z.ZodString;
40
+ status: z.ZodEnum<{
41
+ start: "start";
42
+ error: "error";
43
+ done: "done";
44
+ }>;
45
+ exit: z.ZodOptional<z.ZodNumber>;
46
+ stdout: z.ZodOptional<z.ZodString>;
47
+ stderr: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>;
49
+ export type CommandEvent = z.infer<typeof CommandEvent>;
50
+ export declare const CommitEvent: z.ZodObject<{
51
+ type: z.ZodLiteral<"commit">;
52
+ hash: z.ZodString;
53
+ message: z.ZodString;
54
+ }, z.core.$strip>;
55
+ export type CommitEvent = z.infer<typeof CommitEvent>;
56
+ export declare const SpawnEvent: z.ZodObject<{
57
+ type: z.ZodLiteral<"spawn">;
58
+ name: z.ZodString;
59
+ agent: z.ZodString;
60
+ model: z.ZodString;
61
+ task: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strip>;
63
+ export type SpawnEvent = z.infer<typeof SpawnEvent>;
64
+ export declare const WorkersEvent: z.ZodObject<{
65
+ type: z.ZodLiteral<"workers">;
66
+ workers: z.ZodArray<z.ZodObject<{
67
+ name: z.ZodString;
68
+ status: z.ZodEnum<{
69
+ error: "error";
70
+ idle: "idle";
71
+ thinking: "thinking";
72
+ running: "running";
73
+ done: "done";
74
+ }>;
75
+ }, z.core.$strip>>;
76
+ }, z.core.$strip>;
77
+ export type WorkersEvent = z.infer<typeof WorkersEvent>;
78
+ export declare const StatusEvent: z.ZodObject<{
79
+ type: z.ZodLiteral<"status">;
80
+ state: z.ZodEnum<{
81
+ error: "error";
82
+ idle: "idle";
83
+ thinking: "thinking";
84
+ running: "running";
85
+ done: "done";
86
+ }>;
87
+ context_pct: z.ZodOptional<z.ZodNumber>;
88
+ }, z.core.$strip>;
89
+ export type StatusEvent = z.infer<typeof StatusEvent>;
90
+ export declare const HandoffEvent: z.ZodObject<{
91
+ type: z.ZodLiteral<"handoff">;
92
+ summary: z.ZodString;
93
+ }, z.core.$strip>;
94
+ export type HandoffEvent = z.infer<typeof HandoffEvent>;
95
+ export declare const DoneEvent: z.ZodObject<{
96
+ type: z.ZodLiteral<"done">;
97
+ summary: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strip>;
99
+ export type DoneEvent = z.infer<typeof DoneEvent>;
100
+ export declare const AgentEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
101
+ type: z.ZodLiteral<"text">;
102
+ content: z.ZodString;
103
+ }, z.core.$strip>, z.ZodObject<{
104
+ type: z.ZodLiteral<"tool">;
105
+ name: z.ZodString;
106
+ path: z.ZodOptional<z.ZodString>;
107
+ status: z.ZodEnum<{
108
+ start: "start";
109
+ error: "error";
110
+ done: "done";
111
+ }>;
112
+ output: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$strip>, z.ZodObject<{
114
+ type: z.ZodLiteral<"command">;
115
+ cmd: z.ZodString;
116
+ status: z.ZodEnum<{
117
+ start: "start";
118
+ error: "error";
119
+ done: "done";
120
+ }>;
121
+ exit: z.ZodOptional<z.ZodNumber>;
122
+ stdout: z.ZodOptional<z.ZodString>;
123
+ stderr: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>, z.ZodObject<{
125
+ type: z.ZodLiteral<"commit">;
126
+ hash: z.ZodString;
127
+ message: z.ZodString;
128
+ }, z.core.$strip>, z.ZodObject<{
129
+ type: z.ZodLiteral<"spawn">;
130
+ name: z.ZodString;
131
+ agent: z.ZodString;
132
+ model: z.ZodString;
133
+ task: z.ZodOptional<z.ZodString>;
134
+ }, z.core.$strip>, z.ZodObject<{
135
+ type: z.ZodLiteral<"workers">;
136
+ workers: z.ZodArray<z.ZodObject<{
137
+ name: z.ZodString;
138
+ status: z.ZodEnum<{
139
+ error: "error";
140
+ idle: "idle";
141
+ thinking: "thinking";
142
+ running: "running";
143
+ done: "done";
144
+ }>;
145
+ }, z.core.$strip>>;
146
+ }, z.core.$strip>, z.ZodObject<{
147
+ type: z.ZodLiteral<"status">;
148
+ state: z.ZodEnum<{
149
+ error: "error";
150
+ idle: "idle";
151
+ thinking: "thinking";
152
+ running: "running";
153
+ done: "done";
154
+ }>;
155
+ context_pct: z.ZodOptional<z.ZodNumber>;
156
+ }, z.core.$strip>, z.ZodObject<{
157
+ type: z.ZodLiteral<"handoff">;
158
+ summary: z.ZodString;
159
+ }, z.core.$strip>, z.ZodObject<{
160
+ type: z.ZodLiteral<"done">;
161
+ summary: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strip>], "type">;
163
+ export type AgentEvent = z.infer<typeof AgentEvent>;
164
+ export declare const UserMessage: z.ZodObject<{
165
+ type: z.ZodLiteral<"message">;
166
+ from: z.ZodEnum<{
167
+ user: "user";
168
+ parent: "parent";
169
+ system: "system";
170
+ }>;
171
+ content: z.ZodString;
172
+ }, z.core.$strip>;
173
+ export type UserMessage = z.infer<typeof UserMessage>;
174
+ export declare const SignalMessage: z.ZodObject<{
175
+ type: z.ZodLiteral<"signal">;
176
+ action: z.ZodEnum<{
177
+ stop: "stop";
178
+ pause: "pause";
179
+ resume: "resume";
180
+ }>;
181
+ }, z.core.$strip>;
182
+ export type SignalMessage = z.infer<typeof SignalMessage>;
183
+ export declare const AgentInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
184
+ type: z.ZodLiteral<"message">;
185
+ from: z.ZodEnum<{
186
+ user: "user";
187
+ parent: "parent";
188
+ system: "system";
189
+ }>;
190
+ content: z.ZodString;
191
+ }, z.core.$strip>, z.ZodObject<{
192
+ type: z.ZodLiteral<"signal">;
193
+ action: z.ZodEnum<{
194
+ stop: "stop";
195
+ pause: "pause";
196
+ resume: "resume";
197
+ }>;
198
+ }, z.core.$strip>], "type">;
199
+ export type AgentInput = z.infer<typeof AgentInput>;
200
+ export declare function parseAgentEvent(line: string): AgentEvent | null;
201
+ export declare function serializeInput(input: AgentInput): string;
202
+ /**
203
+ * Maps a Filepath AgentEvent to a Gateproof Log entry.
204
+ *
205
+ * This is the bridge between the two systems: Filepath's NDJSON protocol
206
+ * becomes observable evidence for gate assertions.
207
+ */
208
+ export declare function agentEventToLog(event: AgentEvent, agentName?: string): Log;
209
+ /**
210
+ * Parses an NDJSON line and maps it to a Log entry.
211
+ * Returns null for unparseable lines (graceful degradation).
212
+ */
213
+ export declare function ndjsonLineToLog(line: string, agentName?: string): Log | null;
214
+ //# sourceMappingURL=filepath-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filepath-protocol.d.ts","sourceRoot":"","sources":["../src/filepath-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAInC,eAAO,MAAM,WAAW;;;;;;EAMtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAItD,eAAO,MAAM,SAAS;;;iBAGpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,SAAS;;;;;;;;;;iBAMpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,YAAY;;;;;;;;;;;iBAOvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,eAAO,MAAM,WAAW;;;;iBAItB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,UAAU;;;;;;iBAMrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eA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AC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,GAAG,CAwG1E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAI5E"}
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Filepath Agent Protocol (FAP) — Gateproof integration
3
+ *
4
+ * Zod schemas for the NDJSON event stream between Filepath containers
5
+ * and the Gateproof observe layer. Each agent emits structured events
6
+ * on stdout; we parse and map them to Log entries for gate assertions.
7
+ *
8
+ * Protocol source: https://github.com/ACoyfellow/filepath
9
+ */
10
+ import { z } from "zod";
11
+ // ─── Agent Status ───
12
+ export const AgentStatus = z.enum([
13
+ "idle",
14
+ "thinking",
15
+ "running",
16
+ "done",
17
+ "error",
18
+ ]);
19
+ // ─── Output Events (agent stdout → gateproof) ───
20
+ export const TextEvent = z.object({
21
+ type: z.literal("text"),
22
+ content: z.string(),
23
+ });
24
+ export const ToolEvent = z.object({
25
+ type: z.literal("tool"),
26
+ name: z.string(),
27
+ path: z.string().optional(),
28
+ status: z.enum(["start", "done", "error"]),
29
+ output: z.string().optional(),
30
+ });
31
+ export const CommandEvent = z.object({
32
+ type: z.literal("command"),
33
+ cmd: z.string(),
34
+ status: z.enum(["start", "done", "error"]),
35
+ exit: z.number().optional(),
36
+ stdout: z.string().optional(),
37
+ stderr: z.string().optional(),
38
+ });
39
+ export const CommitEvent = z.object({
40
+ type: z.literal("commit"),
41
+ hash: z.string(),
42
+ message: z.string(),
43
+ });
44
+ export const SpawnEvent = z.object({
45
+ type: z.literal("spawn"),
46
+ name: z.string(),
47
+ agent: z.string(),
48
+ model: z.string(),
49
+ task: z.string().optional(),
50
+ });
51
+ export const WorkersEvent = z.object({
52
+ type: z.literal("workers"),
53
+ workers: z.array(z.object({
54
+ name: z.string(),
55
+ status: AgentStatus,
56
+ })),
57
+ });
58
+ export const StatusEvent = z.object({
59
+ type: z.literal("status"),
60
+ state: AgentStatus,
61
+ context_pct: z.number().min(0).max(1).optional(),
62
+ });
63
+ export const HandoffEvent = z.object({
64
+ type: z.literal("handoff"),
65
+ summary: z.string(),
66
+ });
67
+ export const DoneEvent = z.object({
68
+ type: z.literal("done"),
69
+ summary: z.string().optional(),
70
+ });
71
+ export const AgentEvent = z.discriminatedUnion("type", [
72
+ TextEvent,
73
+ ToolEvent,
74
+ CommandEvent,
75
+ CommitEvent,
76
+ SpawnEvent,
77
+ WorkersEvent,
78
+ StatusEvent,
79
+ HandoffEvent,
80
+ DoneEvent,
81
+ ]);
82
+ // ─── Input Messages (gateproof → agent stdin) ───
83
+ export const UserMessage = z.object({
84
+ type: z.literal("message"),
85
+ from: z.enum(["user", "parent", "system"]),
86
+ content: z.string(),
87
+ });
88
+ export const SignalMessage = z.object({
89
+ type: z.literal("signal"),
90
+ action: z.enum(["stop", "pause", "resume"]),
91
+ });
92
+ export const AgentInput = z.discriminatedUnion("type", [
93
+ UserMessage,
94
+ SignalMessage,
95
+ ]);
96
+ // ─── NDJSON Parsing ───
97
+ export function parseAgentEvent(line) {
98
+ try {
99
+ const json = JSON.parse(line);
100
+ const result = AgentEvent.safeParse(json);
101
+ return result.success ? result.data : null;
102
+ }
103
+ catch {
104
+ return null;
105
+ }
106
+ }
107
+ export function serializeInput(input) {
108
+ return JSON.stringify(input);
109
+ }
110
+ // ─── Event → Log Mapping ───
111
+ function statusToLogStatus(status) {
112
+ switch (status) {
113
+ case "start": return "start";
114
+ case "done": return "success";
115
+ case "error": return "error";
116
+ }
117
+ }
118
+ function agentStateToLogStatus(state) {
119
+ switch (state) {
120
+ case "idle": return "info";
121
+ case "thinking": return "start";
122
+ case "running": return "start";
123
+ case "done": return "success";
124
+ case "error": return "error";
125
+ }
126
+ }
127
+ /**
128
+ * Maps a Filepath AgentEvent to a Gateproof Log entry.
129
+ *
130
+ * This is the bridge between the two systems: Filepath's NDJSON protocol
131
+ * becomes observable evidence for gate assertions.
132
+ */
133
+ export function agentEventToLog(event, agentName) {
134
+ const base = {
135
+ timestamp: new Date().toISOString(),
136
+ stage: agentName ?? "agent",
137
+ };
138
+ switch (event.type) {
139
+ case "text":
140
+ return {
141
+ ...base,
142
+ action: "text",
143
+ status: "info",
144
+ data: { content: event.content },
145
+ };
146
+ case "tool":
147
+ return {
148
+ ...base,
149
+ action: `tool:${event.name}`,
150
+ status: statusToLogStatus(event.status),
151
+ data: {
152
+ name: event.name,
153
+ ...(event.path && { path: event.path }),
154
+ ...(event.output && { output: event.output }),
155
+ },
156
+ };
157
+ case "command":
158
+ return {
159
+ ...base,
160
+ action: `cmd:${event.cmd}`,
161
+ status: statusToLogStatus(event.status),
162
+ data: {
163
+ cmd: event.cmd,
164
+ ...(event.exit !== undefined && { exit: event.exit }),
165
+ ...(event.stdout && { stdout: event.stdout }),
166
+ ...(event.stderr && { stderr: event.stderr }),
167
+ },
168
+ ...(event.status === "error" && event.stderr && {
169
+ error: {
170
+ tag: "CommandError",
171
+ message: event.stderr,
172
+ },
173
+ }),
174
+ };
175
+ case "commit":
176
+ return {
177
+ ...base,
178
+ action: "commit",
179
+ status: "success",
180
+ data: { hash: event.hash, message: event.message },
181
+ };
182
+ case "spawn":
183
+ return {
184
+ ...base,
185
+ action: "spawn",
186
+ status: "start",
187
+ data: {
188
+ name: event.name,
189
+ agent: event.agent,
190
+ model: event.model,
191
+ ...(event.task && { task: event.task }),
192
+ },
193
+ };
194
+ case "workers":
195
+ return {
196
+ ...base,
197
+ action: "workers",
198
+ status: "info",
199
+ data: { workers: event.workers },
200
+ };
201
+ case "status":
202
+ return {
203
+ ...base,
204
+ action: "status",
205
+ status: agentStateToLogStatus(event.state),
206
+ data: {
207
+ state: event.state,
208
+ ...(event.context_pct !== undefined && { context_pct: event.context_pct }),
209
+ },
210
+ };
211
+ case "handoff":
212
+ return {
213
+ ...base,
214
+ action: "handoff",
215
+ status: "info",
216
+ data: { summary: event.summary },
217
+ };
218
+ case "done":
219
+ return {
220
+ ...base,
221
+ action: "done",
222
+ status: "success",
223
+ data: {
224
+ ...(event.summary && { summary: event.summary }),
225
+ },
226
+ };
227
+ }
228
+ }
229
+ /**
230
+ * Parses an NDJSON line and maps it to a Log entry.
231
+ * Returns null for unparseable lines (graceful degradation).
232
+ */
233
+ export function ndjsonLineToLog(line, agentName) {
234
+ const event = parseAgentEvent(line);
235
+ if (!event)
236
+ return null;
237
+ return agentEventToLog(event, agentName);
238
+ }
239
+ //# sourceMappingURL=filepath-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filepath-protocol.js","sourceRoot":"","sources":["../src/filepath-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,uBAAuB;AAEvB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC;IAChC,MAAM;IACN,UAAU;IACV,SAAS;IACT,MAAM;IACN,OAAO;CACR,CAAC,CAAC;AAGH,mDAAmD;AAEnD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,YAA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