agent-neckbeard 1.1.29 → 1.1.30

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 (51) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +25 -27
  3. package/dist/archil.d.ts +73 -0
  4. package/dist/archil.js +673 -0
  5. package/dist/build.cjs +129 -5315
  6. package/dist/build.d.cts +9 -5
  7. package/dist/build.d.ts +9 -5
  8. package/dist/build.js +4 -6
  9. package/dist/{chunk-BPXEIXPM.js → chunk-FHNQ5DNA.js} +3264 -564
  10. package/dist/{chunk-FSBTLBB5.js → chunk-I5GIWADK.js} +29 -7
  11. package/dist/chunk-I5NULOJP.js +129 -0
  12. package/dist/chunk-PKUGXECR.js +13 -0
  13. package/dist/chunk-QA4L7ZI2.js +72 -0
  14. package/dist/{chunk-KG6SJM74.js → chunk-VHBDBB3N.js} +8 -5
  15. package/dist/cli.cjs +124 -5309
  16. package/dist/cli.js +7 -8
  17. package/dist/define-gdmBe9RA.d.ts +227 -0
  18. package/dist/durable.d.ts +53 -0
  19. package/dist/durable.js +92 -0
  20. package/dist/index.cjs +720 -988
  21. package/dist/index.d.cts +139 -87
  22. package/dist/index.d.ts +139 -87
  23. package/dist/index.js +12 -11
  24. package/dist/inside.d.ts +15 -0
  25. package/dist/inside.js +530 -0
  26. package/dist/{invoke-client-P2CPBYTF.js → invoke-client-QB2NTZ3L.js} +1 -2
  27. package/dist/pi-watch-legacy.d.ts +4503 -0
  28. package/dist/serve.cjs +9 -439
  29. package/dist/serve.d.cts +14 -1
  30. package/dist/serve.d.ts +14 -1
  31. package/dist/serve.js +3 -5
  32. package/docs/AGENT.md +81 -77
  33. package/docs/DAYTONA.md +2 -0
  34. package/docs/DOCKER.md +0 -1
  35. package/docs/E2B.md +1 -1
  36. package/docs/LEGACY.md +1 -8
  37. package/docs/MODAL.md +1 -1
  38. package/package.json +57 -23
  39. package/types/pi-watch.d.cts +68 -0
  40. package/dist/chunk-33IXN6MM.js +0 -21
  41. package/dist/chunk-6P5I7ZCH.js +0 -2552
  42. package/dist/chunk-YFG4EKZM.js +0 -508
  43. package/dist/sandbox-capabilities-CFjnZ_kB.d.cts +0 -77
  44. package/dist/sandbox-capabilities-CFjnZ_kB.d.ts +0 -77
  45. package/dist/serve-Du2NCz9_.d.cts +0 -111
  46. package/dist/serve-Du2NCz9_.d.ts +0 -111
  47. package/dist/supervisor.cjs +0 -5731
  48. package/dist/supervisor.d.cts +0 -482
  49. package/dist/supervisor.d.ts +0 -482
  50. package/dist/supervisor.js +0 -3187
  51. package/docs/SUPERVISOR.md +0 -258
@@ -1,111 +0,0 @@
1
- /**
2
- * Wire contract between `Agent` on the host and `serve()` in the sandbox. See docs/AGENT.md.
3
- */
4
- declare const TURN_PROTOCOL_VERSION = 3;
5
- /** One record of a turn's stream. `seq` starts at 0 and increases by one per record. */
6
- type TurnRecord<TEvent = unknown> = {
7
- seq: number;
8
- type: 'event';
9
- event: TEvent;
10
- } | {
11
- seq: number;
12
- type: 'end';
13
- outcome: TurnOutcome;
14
- error?: string;
15
- /** Steers the runtime accepted that the turn ended without taking, oldest first. */
16
- undeliveredSteerIds?: string[];
17
- };
18
- type TurnOutcome = 'completed' | 'aborted' | 'failed';
19
- interface StartTurnRequest {
20
- /** Caller-chosen, stable per turn, so a retried start never runs the turn twice. */
21
- turnId: string;
22
- message: string;
23
- /** Set in the agent's `process.env` for this turn only, then restored. */
24
- env?: Record<string, string>;
25
- }
26
- interface SteerTurnRequest {
27
- /** Caller-chosen, stable per steer, so a retried steer is never queued twice. */
28
- steerId: string;
29
- message: string;
30
- }
31
- interface TurnHealth {
32
- ok: true;
33
- protocolVersion: number;
34
- busy: boolean;
35
- turnId: string | null;
36
- }
37
- type PiTurnResult = {
38
- completed: true;
39
- text: string | null;
40
- } | {
41
- completed: false;
42
- error: string;
43
- };
44
- /**
45
- * How a turn of a Pi session ended, from its records: completed when they include its `end`
46
- * record, the turn ended normally, and its last assistant message stopped on its own, with that
47
- * message's text. Records without an `end` record have not shown how the turn ended.
48
- */
49
- declare function getPiTurnResult(records: readonly TurnRecord[]): PiTurnResult;
50
-
51
- /** The parts of a Pi `AgentSession` the bridge drives. */
52
- interface ServedSession {
53
- subscribe(listener: (event: unknown) => void): () => void;
54
- prompt(text: string): Promise<void>;
55
- abort(): Promise<void>;
56
- /**
57
- * Queues a message for the running prompt, which Pi delivers after its current tool calls and
58
- * before its next model call. It may take a while, as Pi runs its input hooks first, and
59
- * resolves to `"handled"` when a hook took the message instead of queueing it. Without it, the
60
- * runtime answers a steer with 501.
61
- */
62
- steer?(text: string): Promise<unknown>;
63
- /**
64
- * Empties the session's queue, returning the steering messages its prompt never took. A session
65
- * with `steer()` needs it: without it the runtime can't take back a steer the turn never took,
66
- * so it answers a steer with 501.
67
- */
68
- clearQueue?(): {
69
- steering: readonly unknown[];
70
- };
71
- /**
72
- * Runs once each turn's outcome is known: outside its deadline, so it can't fail the turn, and
73
- * before its end record, so a host that deletes the sandbox at the end loses nothing, as when
74
- * sending the turn's trace. An abort that arrives meanwhile changes nothing. Keep it bounded; it
75
- * delays the end record. Its errors are ignored.
76
- */
77
- afterTurn?(): Promise<void>;
78
- }
79
- interface ServeOptions {
80
- /** Creates the agent's session before its first turn; the session is reused for every later turn. */
81
- createSession(): Promise<ServedSession>;
82
- /** Converts a session event for the wire. Defaults to Pi's JSON event form. */
83
- toWireEvent?: (event: unknown) => unknown;
84
- /** Defaults to `NECKBEARD_PORT`, then 8080. */
85
- port?: number;
86
- host?: string;
87
- /** Aborts a turn that runs longer, ending it `failed`. */
88
- maxTurnDurationMs?: number;
89
- /**
90
- * How long an aborted or timed-out turn may take to stop before its end record is written anyway,
91
- * since Pi waits for a running tool. The runtime stays busy until the prompt returns. Defaults to 10 seconds.
92
- */
93
- abortGraceMs?: number;
94
- }
95
- interface ServeHandle {
96
- port: number;
97
- close(): Promise<void>;
98
- }
99
- /**
100
- * Pi's JSON event form, which its JSON and RPC modes write: `message_update` drops the
101
- * cumulative `partial` message, which the deltas rebuild, and keeps the usage.
102
- */
103
- declare function toPiJsonEvent(event: unknown): unknown;
104
- /**
105
- * Serves a Pi session over HTTP for `Agent` on the host. Run it as the sandbox image's main
106
- * process. One turn runs at a time, a turn keeps running when its stream disconnects, and a
107
- * stream resumes from any `seq` of the current or previous turn.
108
- */
109
- declare function serve(options: ServeOptions): Promise<ServeHandle>;
110
-
111
- export { type PiTurnResult as P, type StartTurnRequest as S, type TurnRecord as T, type SteerTurnRequest as a, type TurnHealth as b, type ServedSession as c, type ServeHandle as d, TURN_PROTOCOL_VERSION as e, type TurnOutcome as f, getPiTurnResult as g, type ServeOptions as h, serve as s, toPiJsonEvent as t };
@@ -1,111 +0,0 @@
1
- /**
2
- * Wire contract between `Agent` on the host and `serve()` in the sandbox. See docs/AGENT.md.
3
- */
4
- declare const TURN_PROTOCOL_VERSION = 3;
5
- /** One record of a turn's stream. `seq` starts at 0 and increases by one per record. */
6
- type TurnRecord<TEvent = unknown> = {
7
- seq: number;
8
- type: 'event';
9
- event: TEvent;
10
- } | {
11
- seq: number;
12
- type: 'end';
13
- outcome: TurnOutcome;
14
- error?: string;
15
- /** Steers the runtime accepted that the turn ended without taking, oldest first. */
16
- undeliveredSteerIds?: string[];
17
- };
18
- type TurnOutcome = 'completed' | 'aborted' | 'failed';
19
- interface StartTurnRequest {
20
- /** Caller-chosen, stable per turn, so a retried start never runs the turn twice. */
21
- turnId: string;
22
- message: string;
23
- /** Set in the agent's `process.env` for this turn only, then restored. */
24
- env?: Record<string, string>;
25
- }
26
- interface SteerTurnRequest {
27
- /** Caller-chosen, stable per steer, so a retried steer is never queued twice. */
28
- steerId: string;
29
- message: string;
30
- }
31
- interface TurnHealth {
32
- ok: true;
33
- protocolVersion: number;
34
- busy: boolean;
35
- turnId: string | null;
36
- }
37
- type PiTurnResult = {
38
- completed: true;
39
- text: string | null;
40
- } | {
41
- completed: false;
42
- error: string;
43
- };
44
- /**
45
- * How a turn of a Pi session ended, from its records: completed when they include its `end`
46
- * record, the turn ended normally, and its last assistant message stopped on its own, with that
47
- * message's text. Records without an `end` record have not shown how the turn ended.
48
- */
49
- declare function getPiTurnResult(records: readonly TurnRecord[]): PiTurnResult;
50
-
51
- /** The parts of a Pi `AgentSession` the bridge drives. */
52
- interface ServedSession {
53
- subscribe(listener: (event: unknown) => void): () => void;
54
- prompt(text: string): Promise<void>;
55
- abort(): Promise<void>;
56
- /**
57
- * Queues a message for the running prompt, which Pi delivers after its current tool calls and
58
- * before its next model call. It may take a while, as Pi runs its input hooks first, and
59
- * resolves to `"handled"` when a hook took the message instead of queueing it. Without it, the
60
- * runtime answers a steer with 501.
61
- */
62
- steer?(text: string): Promise<unknown>;
63
- /**
64
- * Empties the session's queue, returning the steering messages its prompt never took. A session
65
- * with `steer()` needs it: without it the runtime can't take back a steer the turn never took,
66
- * so it answers a steer with 501.
67
- */
68
- clearQueue?(): {
69
- steering: readonly unknown[];
70
- };
71
- /**
72
- * Runs once each turn's outcome is known: outside its deadline, so it can't fail the turn, and
73
- * before its end record, so a host that deletes the sandbox at the end loses nothing, as when
74
- * sending the turn's trace. An abort that arrives meanwhile changes nothing. Keep it bounded; it
75
- * delays the end record. Its errors are ignored.
76
- */
77
- afterTurn?(): Promise<void>;
78
- }
79
- interface ServeOptions {
80
- /** Creates the agent's session before its first turn; the session is reused for every later turn. */
81
- createSession(): Promise<ServedSession>;
82
- /** Converts a session event for the wire. Defaults to Pi's JSON event form. */
83
- toWireEvent?: (event: unknown) => unknown;
84
- /** Defaults to `NECKBEARD_PORT`, then 8080. */
85
- port?: number;
86
- host?: string;
87
- /** Aborts a turn that runs longer, ending it `failed`. */
88
- maxTurnDurationMs?: number;
89
- /**
90
- * How long an aborted or timed-out turn may take to stop before its end record is written anyway,
91
- * since Pi waits for a running tool. The runtime stays busy until the prompt returns. Defaults to 10 seconds.
92
- */
93
- abortGraceMs?: number;
94
- }
95
- interface ServeHandle {
96
- port: number;
97
- close(): Promise<void>;
98
- }
99
- /**
100
- * Pi's JSON event form, which its JSON and RPC modes write: `message_update` drops the
101
- * cumulative `partial` message, which the deltas rebuild, and keeps the usage.
102
- */
103
- declare function toPiJsonEvent(event: unknown): unknown;
104
- /**
105
- * Serves a Pi session over HTTP for `Agent` on the host. Run it as the sandbox image's main
106
- * process. One turn runs at a time, a turn keeps running when its stream disconnects, and a
107
- * stream resumes from any `seq` of the current or previous turn.
108
- */
109
- declare function serve(options: ServeOptions): Promise<ServeHandle>;
110
-
111
- export { type PiTurnResult as P, type StartTurnRequest as S, type TurnRecord as T, type SteerTurnRequest as a, type TurnHealth as b, type ServedSession as c, type ServeHandle as d, TURN_PROTOCOL_VERSION as e, type TurnOutcome as f, getPiTurnResult as g, type ServeOptions as h, serve as s, toPiJsonEvent as t };