@usine/agents 0.3.0 → 0.5.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 (114) hide show
  1. package/LICENSE +661 -21
  2. package/README.md +100 -30
  3. package/dist/child-host/child-host.d.ts +90 -0
  4. package/dist/child-host/child-host.d.ts.map +1 -0
  5. package/dist/child-host/child-host.js +119 -0
  6. package/dist/child-host/child-host.js.map +1 -0
  7. package/dist/child-host/command.d.ts +22 -0
  8. package/dist/child-host/command.d.ts.map +1 -0
  9. package/dist/child-host/command.js +43 -0
  10. package/dist/child-host/command.js.map +1 -0
  11. package/dist/openai-prices.d.ts +8 -0
  12. package/dist/openai-prices.d.ts.map +1 -0
  13. package/dist/openai-prices.js +28 -0
  14. package/dist/openai-prices.js.map +1 -0
  15. package/dist/pi/authentication.d.ts +11 -2
  16. package/dist/pi/authentication.d.ts.map +1 -1
  17. package/dist/pi/authentication.js +15 -2
  18. package/dist/pi/authentication.js.map +1 -1
  19. package/dist/pi/children.d.ts +1 -4
  20. package/dist/pi/children.d.ts.map +1 -1
  21. package/dist/pi/children.js +1 -4
  22. package/dist/pi/children.js.map +1 -1
  23. package/dist/pi/claude/claude.d.ts +10 -0
  24. package/dist/pi/claude/claude.d.ts.map +1 -0
  25. package/dist/pi/claude/claude.js +610 -0
  26. package/dist/pi/claude/claude.js.map +1 -0
  27. package/dist/pi/claude/codec.d.ts +67 -0
  28. package/dist/pi/claude/codec.d.ts.map +1 -0
  29. package/dist/pi/claude/codec.js +140 -0
  30. package/dist/pi/claude/codec.js.map +1 -0
  31. package/dist/pi/{claude.d.ts → claude/sdk.d.ts} +11 -10
  32. package/dist/pi/claude/sdk.d.ts.map +1 -0
  33. package/dist/pi/claude/sdk.js +63 -0
  34. package/dist/pi/claude/sdk.js.map +1 -0
  35. package/dist/pi/codex/account.d.ts +11 -5
  36. package/dist/pi/codex/account.d.ts.map +1 -1
  37. package/dist/pi/codex/account.js +23 -6
  38. package/dist/pi/codex/account.js.map +1 -1
  39. package/dist/pi/codex/app-server.d.ts +19 -7
  40. package/dist/pi/codex/app-server.d.ts.map +1 -1
  41. package/dist/pi/codex/app-server.js +41 -36
  42. package/dist/pi/codex/app-server.js.map +1 -1
  43. package/dist/pi/codex/codec.d.ts +10 -84
  44. package/dist/pi/codex/codec.d.ts.map +1 -1
  45. package/dist/pi/codex/codec.js +18 -80
  46. package/dist/pi/codex/codec.js.map +1 -1
  47. package/dist/pi/codex/codex.d.ts +0 -1
  48. package/dist/pi/codex/codex.d.ts.map +1 -1
  49. package/dist/pi/codex/codex.js +89 -18
  50. package/dist/pi/codex/codex.js.map +1 -1
  51. package/dist/pi/conversation.d.ts +33 -12
  52. package/dist/pi/conversation.d.ts.map +1 -1
  53. package/dist/pi/conversation.js +58 -18
  54. package/dist/pi/conversation.js.map +1 -1
  55. package/dist/pi/pi.d.ts +1 -4
  56. package/dist/pi/pi.d.ts.map +1 -1
  57. package/dist/pi/pi.js +29 -175
  58. package/dist/pi/pi.js.map +1 -1
  59. package/dist/pi/sdk.d.ts +18 -15
  60. package/dist/pi/sdk.d.ts.map +1 -1
  61. package/dist/pi/sdk.js +45 -55
  62. package/dist/pi/sdk.js.map +1 -1
  63. package/dist/pi/session.d.ts +13 -14
  64. package/dist/pi/session.d.ts.map +1 -1
  65. package/dist/pi/session.js +63 -24
  66. package/dist/pi/session.js.map +1 -1
  67. package/dist/pi/turns.d.ts +7 -7
  68. package/dist/pi/turns.d.ts.map +1 -1
  69. package/dist/pi/turns.js +22 -9
  70. package/dist/pi/turns.js.map +1 -1
  71. package/dist/pi/usage.d.ts +36 -22
  72. package/dist/pi/usage.d.ts.map +1 -1
  73. package/dist/pi/usage.js +79 -33
  74. package/dist/pi/usage.js.map +1 -1
  75. package/dist/preflight/command.d.ts +16 -4
  76. package/dist/preflight/command.d.ts.map +1 -1
  77. package/dist/preflight/command.js +29 -27
  78. package/dist/preflight/command.js.map +1 -1
  79. package/dist/preflight/preflight.d.ts +19 -7
  80. package/dist/preflight/preflight.d.ts.map +1 -1
  81. package/dist/preflight/preflight.js +73 -32
  82. package/dist/preflight/preflight.js.map +1 -1
  83. package/dist/prompt.d.ts +12 -9
  84. package/dist/prompt.d.ts.map +1 -1
  85. package/dist/prompt.js +33 -4
  86. package/dist/prompt.js.map +1 -1
  87. package/dist/protocol/codex.d.ts +122 -7
  88. package/dist/protocol/codex.d.ts.map +1 -1
  89. package/dist/protocol/codex.js +109 -1
  90. package/dist/protocol/codex.js.map +1 -1
  91. package/dist/protocol/count.d.ts +4 -0
  92. package/dist/protocol/count.d.ts.map +1 -0
  93. package/dist/protocol/count.js +4 -0
  94. package/dist/protocol/count.js.map +1 -0
  95. package/dist/runtime.d.ts +110 -55
  96. package/dist/runtime.d.ts.map +1 -1
  97. package/dist/runtime.js +114 -27
  98. package/dist/runtime.js.map +1 -1
  99. package/package.json +35 -19
  100. package/dist/pi/claude.d.ts.map +0 -1
  101. package/dist/pi/claude.js +0 -302
  102. package/dist/pi/claude.js.map +0 -1
  103. package/dist/pi/live.d.ts +0 -4
  104. package/dist/pi/live.d.ts.map +0 -1
  105. package/dist/pi/live.js +0 -11
  106. package/dist/pi/live.js.map +0 -1
  107. package/dist/pi/subagents.d.ts +0 -29
  108. package/dist/pi/subagents.d.ts.map +0 -1
  109. package/dist/pi/subagents.js +0 -120
  110. package/dist/pi/subagents.js.map +0 -1
  111. package/dist/pi/thinking.d.ts +0 -8
  112. package/dist/pi/thinking.d.ts.map +0 -1
  113. package/dist/pi/thinking.js +0 -15
  114. package/dist/pi/thinking.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,iBAAiB,EAGjB,YAAY,EAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAEL,cAAc,EAGf,MAAM,6BAA6B,CA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,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;;AAlB5E;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,oBAaD;CAAG;;AAEvC,yCAAyC;AACzC,qBAAa,kBAAmB,SAAQ,uBAEvC;CAAG;;AAEJ,mCAAmC;AACnC,qBAAa,iBAAkB,SAAQ,sBAEtC;CAAG;;AAEJ,gCAAgC;AAChC,qBAAa,cAAe,SAAQ,mBAEnC;CAAG"}
package/dist/runtime.js CHANGED
@@ -1,21 +1,33 @@
1
1
  import { Effort, Harness, ModelId } from "@usine/core/agent/brain";
2
2
  import { AgentSession, AgentSessionEvent, AgentSessionId, BillingPool, ChildSession, ChildSessionBudget, ChildSessionCount, } from "@usine/core/agent/session";
3
3
  import * as AttemptChannel from "@usine/core/attempt/channel";
4
- import { AgentFailure, AttemptFailure, ChildSessionBudgetFailure, InfraFailure, } from "@usine/core/attempt/failure";
5
- import { Context, Effect, Match, Schema, Scope, Stream } from "effect";
6
- /** The checkout directory one Attempt runs in. */
4
+ import { MachineId, WorkerName } from "@usine/core/worker";
5
+ import { AgentFailure, AttemptFailure, BlockedFailure, ChildSessionBudgetFailure, InfraFailure, QuestionFailure, } from "@usine/core/attempt/failure";
6
+ import { Context, Effect, Match, Option, Schema, Scope, Stream } from "effect";
7
+ import { ChildHost } from "./child-host/child-host.js";
8
+ /** The checkout directory of an Attempt. */
7
9
  export const WorkingDirectory = Schema.NonEmptyString.pipe(Schema.brand("AgentWorkingDirectory"));
8
- /** The Attempt's task and Agent choices, together with the prepared checkout where its parent starts. */
9
- export class LaunchRequest extends Schema.Class("@usine/agents/LaunchRequest")({
10
- spec: AttemptChannel.RunSpec,
11
- cwd: WorkingDirectory,
12
- }) {
13
- }
14
- /** Work delegated to one child, with its assigned identity and the checkout it shares with the parent. */
10
+ /** A task delegated to one child, with its session and the checkout it shares with the parent. */
15
11
  export class ChildRequest extends Schema.Class("@usine/agents/ChildRequest")({
16
12
  session: ChildSession,
13
+ /** The checkout directory on `host`. */
17
14
  cwd: WorkingDirectory,
18
15
  prompt: Schema.NonEmptyString,
16
+ /**
17
+ * The complete environment of the child process and its commands: the Worker's allowlisted
18
+ * variables plus the Attempt's credential configuration, with nothing inherited from the launching
19
+ * process (ADR 0011). On a `RemoteShell` host, the variables are exported on top of the remote
20
+ * environment, which contains no orchestrator secret.
21
+ */
22
+ environment: Schema.Record(Schema.String, Schema.String),
23
+ host: ChildHost,
24
+ /** The Worker that `host` runs on. */
25
+ worker: WorkerName,
26
+ /**
27
+ * The provider's ID of the machine that a provisioned Worker created for the Attempt, or `None`
28
+ * on other Workers, whose Attempts share one Claude login.
29
+ */
30
+ machine: Schema.Option(MachineId),
19
31
  }) {
20
32
  }
21
33
  /** The final message a parent or child session returns. */
@@ -23,14 +35,14 @@ export class SessionResult extends Schema.Class("@usine/agents/SessionResult")({
23
35
  message: Schema.NonEmptyString,
24
36
  }) {
25
37
  }
26
- /** The rostered model id is well-formed but the SDK's registry does not list it. */
38
+ /** An error for a well-formed rostered model ID that the SDK's registry does not list. */
27
39
  export class UnknownModelError extends Schema.TaggedError("@usine/agents/UnknownModelError")("UnknownModelError", {
28
40
  harness: Harness,
29
41
  model: ModelId,
30
42
  message: Schema.NonEmptyString,
31
43
  }) {
32
44
  }
33
- /** The credential cannot spend from the billing pool this session needs. */
45
+ /** An error for a credential that cannot use the billing pool the session needs. */
34
46
  export class PoolUnavailableError extends Schema.TaggedError("@usine/agents/PoolUnavailableError")("PoolUnavailableError", {
35
47
  harness: Harness,
36
48
  model: ModelId,
@@ -38,7 +50,7 @@ export class PoolUnavailableError extends Schema.TaggedError("@usine/agents/Pool
38
50
  message: Schema.NonEmptyString,
39
51
  }) {
40
52
  }
41
- /** The model exists but does not support the rostered reasoning effort. */
53
+ /** An error for a model that does not support the rostered reasoning effort. */
42
54
  export class UnsupportedEffortError extends Schema.TaggedError("@usine/agents/UnsupportedEffortError")("UnsupportedEffortError", {
43
55
  harness: Harness,
44
56
  model: ModelId,
@@ -46,13 +58,41 @@ export class UnsupportedEffortError extends Schema.TaggedError("@usine/agents/Un
46
58
  message: Schema.NonEmptyString,
47
59
  }) {
48
60
  }
49
- /** The session finished and reported that the work itself failed. */
61
+ /**
62
+ * The reserved prefix of a final answer that reports an unresolved blocker. The session fails with
63
+ * `AgentBlockedError`, whose message is the text after the marker.
64
+ */
65
+ export const BLOCKED_MARKER = "[usine:blocked]";
66
+ /**
67
+ * The reserved prefix of a final answer that asks the operator for a decision. The session fails
68
+ * with `AgentQuestionError`, whose message is the text after the marker.
69
+ */
70
+ export const QUESTION_MARKER = "[usine:question]";
71
+ /**
72
+ * The reserved prefix of a report that relays a harness failure, such as a child's failed Codex
73
+ * turn, to the parent. The session fails with `AgentResultError`, which ends the Attempt with
74
+ * `AgentFailure`.
75
+ */
76
+ export const FAILED_MARKER = "[usine:failed]";
77
+ /** An error for a session that finished and reported that the work failed. */
50
78
  export class AgentResultError extends Schema.TaggedError("@usine/agents/AgentResultError")("AgentResultError", {
51
79
  sessionId: Schema.OptionFromNullOr(AgentSessionId),
52
80
  message: Schema.NonEmptyString,
53
81
  }) {
54
82
  }
55
- /** The Pi parent asked for one more child than this Attempt's budget allows. */
83
+ /** An error for a session that finished with the blocker marker; `message` is the blocker text. */
84
+ export class AgentBlockedError extends Schema.TaggedError("@usine/agents/AgentBlockedError")("AgentBlockedError", {
85
+ sessionId: Schema.OptionFromNullOr(AgentSessionId),
86
+ message: Schema.NonEmptyString,
87
+ }) {
88
+ }
89
+ /** An error for a session that finished with a question for the operator; `message` is the question. */
90
+ export class AgentQuestionError extends Schema.TaggedError("@usine/agents/AgentQuestionError")("AgentQuestionError", {
91
+ sessionId: Schema.OptionFromNullOr(AgentSessionId),
92
+ message: Schema.NonEmptyString,
93
+ }) {
94
+ }
95
+ /** An error for a Pi parent that requested more children than the Attempt's budget allows. */
56
96
  export class ChildSessionBudgetExceededError extends Schema.TaggedError("@usine/agents/ChildSessionBudgetExceededError")("ChildSessionBudgetExceededError", {
57
97
  maxChildren: ChildSessionBudget,
58
98
  attemptedChildren: ChildSessionCount,
@@ -61,7 +101,7 @@ export class ChildSessionBudgetExceededError extends Schema.TaggedError("@usine/
61
101
  }
62
102
  export const SESSION_OPERATIONS = ["launch", "stream", "steer", "interrupt"];
63
103
  export const SessionOperation = Schema.Literals(SESSION_OPERATIONS);
64
- /** The SDK or its process failed after the model and harness were validated. */
104
+ /** An error for an SDK or process failure after the model and harness were validated. */
65
105
  export class SessionOperationError extends Schema.TaggedError("@usine/agents/SessionOperationError")("SessionOperationError", {
66
106
  operation: SessionOperation,
67
107
  sessionId: Schema.OptionFromNullOr(AgentSessionId),
@@ -69,19 +109,58 @@ export class SessionOperationError extends Schema.TaggedError("@usine/agents/Ses
69
109
  cause: Schema.Defect(),
70
110
  }) {
71
111
  }
72
- /** A session could not start, continue, or finish its work; the failure determines whether retry needs an operator. */
112
+ /** Any error that stops a session from starting, continuing, or finishing; the error type determines whether a retry needs the operator. */
73
113
  export const AgentSessionError = Schema.Union([
74
114
  UnknownModelError,
75
115
  PoolUnavailableError,
76
116
  UnsupportedEffortError,
77
117
  AgentResultError,
118
+ AgentBlockedError,
119
+ AgentQuestionError,
78
120
  ChildSessionBudgetExceededError,
79
121
  SessionOperationError,
80
122
  ]);
81
123
  /**
82
- * Maps session errors onto the retry taxonomy: an SDK or process failure is
83
- * retryable infrastructure, while a bad roster spec or the agent failing its
84
- * own work waits for the operator (ADR 0002).
124
+ * Returns the report of a final answer that starts with `[usine:blocked]`, `[usine:question]`, or
125
+ * `[usine:failed]`; the details can follow on the same line or the next. Returns `None` if the answer
126
+ * does not start with a marker.
127
+ */
128
+ export const reportedOutcome = (sessionId, answer) => {
129
+ const trimmed = answer.trim();
130
+ if (trimmed.startsWith(QUESTION_MARKER)) {
131
+ return Option.some(new AgentQuestionError({
132
+ sessionId,
133
+ message: trimmed.slice(QUESTION_MARKER.length).trim() ||
134
+ "Agent asked the operator a question without writing it.",
135
+ }));
136
+ }
137
+ if (trimmed.startsWith(BLOCKED_MARKER)) {
138
+ return Option.some(new AgentBlockedError({
139
+ sessionId,
140
+ message: trimmed.slice(BLOCKED_MARKER.length).trim() ||
141
+ "Agent reported an unresolved blocker without details.",
142
+ }));
143
+ }
144
+ if (trimmed.startsWith(FAILED_MARKER)) {
145
+ return Option.some(new AgentResultError({
146
+ sessionId,
147
+ message: trimmed.slice(FAILED_MARKER.length).trim() || "Agent reported a failure without details.",
148
+ }));
149
+ }
150
+ return Option.none();
151
+ };
152
+ /** Returns the final answer that relays `report`, starting with its marker. */
153
+ export const reportText = (report) => {
154
+ const marker = Match.valueTags(report, {
155
+ AgentResultError: () => FAILED_MARKER,
156
+ AgentBlockedError: () => BLOCKED_MARKER,
157
+ AgentQuestionError: () => QUESTION_MARKER,
158
+ });
159
+ return `${marker}\n${report.message}`;
160
+ };
161
+ /**
162
+ * Maps a session error to an Attempt failure: SDK and process failures are retryable infrastructure
163
+ * failures; roster errors and Agent-reported failures wait for the operator (ADR 0002).
85
164
  */
86
165
  export const toAttemptFailure = (error) => Match.valueTags(error, {
87
166
  SessionOperationError: (operation) => new InfraFailure({ message: operation.message, cause: operation.cause }),
@@ -89,21 +168,29 @@ export const toAttemptFailure = (error) => Match.valueTags(error, {
89
168
  PoolUnavailableError: ({ message }) => new AgentFailure({ message }),
90
169
  UnsupportedEffortError: ({ message }) => new AgentFailure({ message }),
91
170
  AgentResultError: ({ message }) => new AgentFailure({ message }),
171
+ AgentBlockedError: ({ message }) => new BlockedFailure({ message }),
172
+ AgentQuestionError: ({ message }) => new QuestionFailure({ question: message }),
92
173
  ChildSessionBudgetExceededError: ({ attemptedChildren, maxChildren }) => new ChildSessionBudgetFailure({ attemptedChildren, maxChildren }),
93
174
  });
94
- /** Runs the coding work delegated by an Attempt's parent. */
175
+ /** The service that runs tasks delegated by an Attempt's parent. */
95
176
  export class ChildBackend extends Context.Service()("@usine/agents/ChildBackend") {
96
177
  }
97
- /** Runs delegated coding work with Claude Code. */
178
+ /**
179
+ * A lock per Claude login for the Claude commands that can refresh it: the preflight login check
180
+ * and the start of a Claude child. Claude Code ends a process that finds another process
181
+ * refreshing the login (#453). Each machine of a provisioned Worker has its own login; on other
182
+ * Workers, all Attempts share one. Provide one instance to both the executor and the Attempt
183
+ * runtime.
184
+ */
185
+ export class ClaudeLoginLock extends Context.Service()("@usine/agents/ClaudeLoginLock") {
186
+ }
187
+ /** The child backend for Claude Code. */
98
188
  export class ClaudeChildBackend extends Context.Service()("@usine/agents/ClaudeChildBackend") {
99
189
  }
100
- /** Runs delegated coding work with Codex. */
190
+ /** The child backend for Codex. */
101
191
  export class CodexChildBackend extends Context.Service()("@usine/agents/CodexChildBackend") {
102
192
  }
103
- /** Runs delegated coding work with Pi. */
193
+ /** The child backend for Pi. */
104
194
  export class PiChildBackend extends Context.Service()("@usine/agents/PiChildBackend") {
105
195
  }
106
- /** Starts the parent that coordinates one Attempt's task and delegates coding work to children. */
107
- export class AgentRuntime extends Context.Service()("@usine/agents/AgentRuntime") {
108
- }
109
196
  //# sourceMappingURL=runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACL,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,YAAY,GACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEvE,kDAAkD;A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,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC/E,+BAA+B,EAAE,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,EAAE,CACtE,IAAI,yBAAyB,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC;CACpE,CAAC,CAAC;AAsCL,oEAAoE;AACpE,MAAM,OAAO,YAAa,SAAQ,OAAO,CAAC,OAAO,EAAqC,CACpF,4BAA4B,CAC7B;CAAG;AAEJ;;;;;;GAMG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAAO,CAAC,OAAO,EAajD,CAAC,+BAA+B,CAAC;CAAG;AAEvC,yCAAyC;AACzC,MAAM,OAAO,kBAAmB,SAAQ,OAAO,CAAC,OAAO,EAA2C,CAChG,kCAAkC,CACnC;CAAG;AAEJ,mCAAmC;AACnC,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,OAAO,EAA0C,CAC9F,iCAAiC,CAClC;CAAG;AAEJ,gCAAgC;AAChC,MAAM,OAAO,cAAe,SAAQ,OAAO,CAAC,OAAO,EAAuC,CACxF,8BAA8B,CAC/B;CAAG"}
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@usine/agents",
3
- "version": "0.3.0",
4
- "description": "The usine agent layer: Pi parent adapter, subagents extension, team roster and brain specs.",
5
- "license": "MIT",
3
+ "version": "0.5.0",
4
+ "description": "The usine agent layer: Claude Code, Codex, and Pi child backends, Attempt prompts, and harness preflight.",
5
+ "license": "AGPL-3.0-only",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/basaltbytes/usine.git",
9
9
  "directory": "packages/agents"
10
10
  },
11
11
  "files": [
12
- "dist"
12
+ "dist",
13
+ "!dist/tsconfig.tsbuildinfo"
13
14
  ],
14
15
  "type": "module",
15
16
  "sideEffects": false,
@@ -18,21 +19,29 @@
18
19
  "types": "./dist/pi/pi.d.ts",
19
20
  "default": "./dist/pi/pi.js"
20
21
  },
22
+ "./child-host": {
23
+ "types": "./dist/child-host/child-host.d.ts",
24
+ "default": "./dist/child-host/child-host.js"
25
+ },
21
26
  "./children": {
22
27
  "types": "./dist/pi/children.d.ts",
23
28
  "default": "./dist/pi/children.js"
24
29
  },
25
30
  "./claude": {
26
- "types": "./dist/pi/claude.d.ts",
27
- "default": "./dist/pi/claude.js"
31
+ "types": "./dist/pi/claude/claude.d.ts",
32
+ "default": "./dist/pi/claude/claude.js"
28
33
  },
29
34
  "./codex": {
30
35
  "types": "./dist/pi/codex/codex.d.ts",
31
36
  "default": "./dist/pi/codex/codex.js"
32
37
  },
33
- "./pi/live": {
34
- "types": "./dist/pi/live.d.ts",
35
- "default": "./dist/pi/live.js"
38
+ "./openai-prices": {
39
+ "types": "./dist/openai-prices.d.ts",
40
+ "default": "./dist/openai-prices.js"
41
+ },
42
+ "./pi/authentication": {
43
+ "types": "./dist/pi/authentication.d.ts",
44
+ "default": "./dist/pi/authentication.js"
36
45
  },
37
46
  "./prompt": {
38
47
  "types": "./dist/prompt.d.ts",
@@ -51,22 +60,28 @@
51
60
  "access": "public"
52
61
  },
53
62
  "dependencies": {
54
- "@anthropic-ai/claude-agent-sdk": "0.3.261",
55
- "@earendil-works/pi-coding-agent": "0.85.1",
56
- "typebox": "1.3.7",
57
- "@usine/core": "0.3.0"
63
+ "@anthropic-ai/claude-agent-sdk": "0.3.308",
64
+ "@earendil-works/chord": "1.2.0",
65
+ "@earendil-works/pi-agent-core": "1.2.0",
66
+ "@earendil-works/pi-ai": "1.2.0",
67
+ "@earendil-works/pi-codemode": "1.2.0",
68
+ "@earendil-works/pi-coding-agent": "1.2.0",
69
+ "@earendil-works/pi-mcp": "1.2.0",
70
+ "@earendil-works/pi-telemetry": "1.2.0",
71
+ "@earendil-works/pi-tui": "1.2.0",
72
+ "@usine/core": "0.5.0"
58
73
  },
59
74
  "devDependencies": {
60
- "@effect/platform-node": "4.0.0-rc.111",
61
- "@effect/vitest": "4.0.0-rc.111",
62
- "@pwrdrvr/codex-app-server-protocol": "0.144.0",
63
- "effect": "4.0.0-rc.111",
75
+ "@effect/platform-node": "4.0.6",
76
+ "@effect/vitest": "4.0.6",
77
+ "@pwrdrvr/codex-app-server-protocol": "0.159.2",
78
+ "effect": "4.0.6",
64
79
  "typescript": "7.0.2",
65
- "vitest": "4.1.11",
80
+ "vitest": "5.0.5",
66
81
  "@usine/tsconfig": "0.0.0"
67
82
  },
68
83
  "peerDependencies": {
69
- "effect": "4.0.0-rc.111"
84
+ "effect": "4.0.6"
70
85
  },
71
86
  "engines": {
72
87
  "node": ">=22"
@@ -75,6 +90,7 @@
75
90
  "build": "tsc -b",
76
91
  "check": "tsc -p tsconfig.check.json && tsc -p tsconfig.conformance.json",
77
92
  "test": "vitest run --exclude 'test/integration/**'",
93
+ "test:integration:claude": "vitest run test/integration/claude.test.ts",
78
94
  "test:integration:codex": "vitest run test/integration/codex.test.ts",
79
95
  "test:integration:pi": "vitest run test/integration/pi.test.ts"
80
96
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/pi/claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EAIb,MAAM,gCAAgC,CAAC;AAaxC,OAAO,EAAE,OAAO,EAA2B,KAAK,EAAe,MAAM,EAAU,MAAM,QAAQ,CAAC;AAC9F,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAKb,MAAM,eAAe,CAAC;AAKvB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC;CACnC;AAED,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,OAAO,EACL,iCAAiC,GACjC,KAAK,GACL,QAAQ,GAC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