@usine/agents 0.0.0 → 0.1.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/LICENSE +21 -0
- package/README.md +28 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/pi/authentication.d.ts +13 -0
- package/dist/pi/authentication.d.ts.map +1 -0
- package/dist/pi/authentication.js +14 -0
- package/dist/pi/authentication.js.map +1 -0
- package/dist/pi/children.d.ts +5 -0
- package/dist/pi/children.d.ts.map +1 -0
- package/dist/pi/children.js +26 -0
- package/dist/pi/children.js.map +1 -0
- package/dist/pi/claude.d.ts +32 -0
- package/dist/pi/claude.d.ts.map +1 -0
- package/dist/pi/claude.js +237 -0
- package/dist/pi/claude.js.map +1 -0
- package/dist/pi/codex/app-server.d.ts +24 -0
- package/dist/pi/codex/app-server.d.ts.map +1 -0
- package/dist/pi/codex/app-server.js +188 -0
- package/dist/pi/codex/app-server.js.map +1 -0
- package/dist/pi/codex/codex.d.ts +5 -0
- package/dist/pi/codex/codex.d.ts.map +1 -0
- package/dist/pi/codex/codex.js +342 -0
- package/dist/pi/codex/codex.js.map +1 -0
- package/dist/pi/index.d.ts +11 -0
- package/dist/pi/index.d.ts.map +1 -0
- package/dist/pi/index.js +18 -0
- package/dist/pi/index.js.map +1 -0
- package/dist/pi/pi.d.ts +7 -0
- package/dist/pi/pi.d.ts.map +1 -0
- package/dist/pi/pi.js +273 -0
- package/dist/pi/pi.js.map +1 -0
- package/dist/pi/sdk.d.ts +66 -0
- package/dist/pi/sdk.d.ts.map +1 -0
- package/dist/pi/sdk.js +154 -0
- package/dist/pi/sdk.js.map +1 -0
- package/dist/pi/session.d.ts +46 -0
- package/dist/pi/session.d.ts.map +1 -0
- package/dist/pi/session.js +180 -0
- package/dist/pi/session.js.map +1 -0
- package/dist/pi/subagents.d.ts +23 -0
- package/dist/pi/subagents.d.ts.map +1 -0
- package/dist/pi/subagents.js +83 -0
- package/dist/pi/subagents.js.map +1 -0
- package/dist/prompt.d.ts +22 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +42 -0
- package/dist/prompt.js.map +1 -0
- package/dist/protocol/codex.d.ts +56 -0
- package/dist/protocol/codex.d.ts.map +1 -0
- package/dist/protocol/codex.js +2 -0
- package/dist/protocol/codex.js.map +1 -0
- package/dist/runtime.d.ts +114 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +96 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +54 -4
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Agent, AttemptChannel, AttemptFailure } from "@usine/core";
|
|
2
|
+
import { Context, Effect, Match, Schema, Scope, Stream } from "effect";
|
|
3
|
+
/** Value object: process-local working directory for one isolated Attempt. */
|
|
4
|
+
export const WorkingDirectory = Schema.NonEmptyString.pipe(Schema.brand("AgentWorkingDirectory"));
|
|
5
|
+
/** Complete input required to start the Pi parent inside one Attempt checkout. */
|
|
6
|
+
export class LaunchRequest extends Schema.Class("@usine/agents/LaunchRequest")({
|
|
7
|
+
spec: AttemptChannel.RunSpec,
|
|
8
|
+
cwd: WorkingDirectory,
|
|
9
|
+
}) {
|
|
10
|
+
}
|
|
11
|
+
/** Complete input for exactly one first-level child session. */
|
|
12
|
+
export class ChildRequest extends Schema.Class("@usine/agents/ChildRequest")({
|
|
13
|
+
session: Agent.ChildSession,
|
|
14
|
+
cwd: WorkingDirectory,
|
|
15
|
+
prompt: Schema.NonEmptyString,
|
|
16
|
+
}) {
|
|
17
|
+
}
|
|
18
|
+
/** Terminal semantic output from a parent or child SDK session. */
|
|
19
|
+
export class SessionResult extends Schema.Class("@usine/agents/SessionResult")({
|
|
20
|
+
message: Schema.NonEmptyString,
|
|
21
|
+
}) {
|
|
22
|
+
}
|
|
23
|
+
/** The configured vendor model id is well-formed but absent from the selected SDK registry. */
|
|
24
|
+
export class UnknownModelError extends Schema.TaggedError("@usine/agents/UnknownModelError")("UnknownModelError", {
|
|
25
|
+
harness: Agent.Harness,
|
|
26
|
+
model: Agent.ModelId,
|
|
27
|
+
message: Schema.NonEmptyString,
|
|
28
|
+
}) {
|
|
29
|
+
}
|
|
30
|
+
/** The selected credential cannot draw from the billing pool required by this session. */
|
|
31
|
+
export class PoolUnavailableError extends Schema.TaggedError("@usine/agents/PoolUnavailableError")("PoolUnavailableError", {
|
|
32
|
+
harness: Agent.Harness,
|
|
33
|
+
model: Agent.ModelId,
|
|
34
|
+
pool: Agent.Pool,
|
|
35
|
+
message: Schema.NonEmptyString,
|
|
36
|
+
}) {
|
|
37
|
+
}
|
|
38
|
+
/** The selected model exists but does not support the rostered reasoning effort. */
|
|
39
|
+
export class UnsupportedEffortError extends Schema.TaggedError("@usine/agents/UnsupportedEffortError")("UnsupportedEffortError", {
|
|
40
|
+
harness: Agent.Harness,
|
|
41
|
+
model: Agent.ModelId,
|
|
42
|
+
effort: Agent.Effort,
|
|
43
|
+
message: Schema.NonEmptyString,
|
|
44
|
+
}) {
|
|
45
|
+
}
|
|
46
|
+
/** The session ran to a terminal state and reported that the work itself failed. */
|
|
47
|
+
export class AgentResultError extends Schema.TaggedError("@usine/agents/AgentResultError")("AgentResultError", {
|
|
48
|
+
sessionId: Schema.OptionFromNullOr(Agent.SessionId),
|
|
49
|
+
message: Schema.NonEmptyString,
|
|
50
|
+
}) {
|
|
51
|
+
}
|
|
52
|
+
export const SESSION_OPERATIONS = ["launch", "stream", "steer", "interrupt"];
|
|
53
|
+
export const SessionOperation = Schema.Literals(SESSION_OPERATIONS);
|
|
54
|
+
/** SDK/process failure after model and harness validation. */
|
|
55
|
+
export class SessionOperationError extends Schema.TaggedError("@usine/agents/SessionOperationError")("SessionOperationError", {
|
|
56
|
+
operation: SessionOperation,
|
|
57
|
+
sessionId: Schema.OptionFromNullOr(Agent.SessionId),
|
|
58
|
+
message: Schema.NonEmptyString,
|
|
59
|
+
cause: Schema.Defect(),
|
|
60
|
+
}) {
|
|
61
|
+
}
|
|
62
|
+
export const AgentSessionError = Schema.Union([
|
|
63
|
+
UnknownModelError,
|
|
64
|
+
PoolUnavailableError,
|
|
65
|
+
UnsupportedEffortError,
|
|
66
|
+
AgentResultError,
|
|
67
|
+
SessionOperationError,
|
|
68
|
+
]);
|
|
69
|
+
/**
|
|
70
|
+
* The one place the session error union meets the ADR 0002 retry taxonomy:
|
|
71
|
+
* SDK/process trouble is retryable infrastructure; a bad roster spec or the
|
|
72
|
+
* agent failing its own work always waits for the operator.
|
|
73
|
+
*/
|
|
74
|
+
export const toAttemptFailure = (error) => Match.valueTags(error, {
|
|
75
|
+
SessionOperationError: (operation) => new AttemptFailure.InfraFailure({ message: operation.message, cause: operation.cause }),
|
|
76
|
+
UnknownModelError: ({ message }) => new AttemptFailure.AgentFailure({ message }),
|
|
77
|
+
PoolUnavailableError: ({ message }) => new AttemptFailure.AgentFailure({ message }),
|
|
78
|
+
UnsupportedEffortError: ({ message }) => new AttemptFailure.AgentFailure({ message }),
|
|
79
|
+
AgentResultError: ({ message }) => new AttemptFailure.AgentFailure({ message }),
|
|
80
|
+
});
|
|
81
|
+
/** Stable first-level child seam selected by the authored BrainSpec harness. */
|
|
82
|
+
export class ChildBackend extends Context.Service()("@usine/agents/ChildBackend") {
|
|
83
|
+
}
|
|
84
|
+
/** Concrete Claude child implementation consumed by the harness dispatcher. */
|
|
85
|
+
export class ClaudeChildBackend extends Context.Service()("@usine/agents/ClaudeChildBackend") {
|
|
86
|
+
}
|
|
87
|
+
/** Concrete Codex child implementation consumed by the harness dispatcher. */
|
|
88
|
+
export class CodexChildBackend extends Context.Service()("@usine/agents/CodexChildBackend") {
|
|
89
|
+
}
|
|
90
|
+
/** Concrete Pi child implementation consumed by the harness dispatcher. */
|
|
91
|
+
export class PiChildBackend extends Context.Service()("@usine/agents/PiChildBackend") {
|
|
92
|
+
}
|
|
93
|
+
/** Stable parent seam consumed by the run host. */
|
|
94
|
+
export class AgentRuntime extends Context.Service()("@usine/agents/AgentRuntime") {
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEvE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAGlG,kFAAkF;AAClF,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,KAAK,CAAgB,6BAA6B,CAAC,CAAC;IAC5F,IAAI,EAAE,cAAc,CAAC,OAAO;IAC5B,GAAG,EAAE,gBAAgB;CACtB,CAAC;CAAG;AAEL,gEAAgE;AAChE,MAAM,OAAO,YAAa,SAAQ,MAAM,CAAC,KAAK,CAAe,4BAA4B,CAAC,CAAC;IACzF,OAAO,EAAE,KAAK,CAAC,YAAY;IAC3B,GAAG,EAAE,gBAAgB;IACrB,MAAM,EAAE,MAAM,CAAC,cAAc;CAC9B,CAAC;CAAG;AAEL,mEAAmE;AACnE,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,KAAK,CAAgB,6BAA6B,CAAC,CAAC;IAC5F,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG;AAEL,+FAA+F;AAC/F,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,CACvD,iCAAiC,CAClC,CAAC,mBAAmB,EAAE;IACrB,OAAO,EAAE,KAAK,CAAC,OAAO;IACtB,KAAK,EAAE,KAAK,CAAC,OAAO;IAC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AAC9E,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,OAAO,EAA0C,CAC9F,iCAAiC,CAClC;CAAG;AAEJ,2EAA2E;AAC3E,MAAM,OAAO,cAAe,SAAQ,OAAO,CAAC,OAAO,EAAuC,CACxF,8BAA8B,CAC/B;CAAG;AAEJ,mDAAmD;AACnD,MAAM,OAAO,YAAa,SAAQ,OAAO,CAAC,OAAO,EAO9C,CAAC,4BAA4B,CAAC;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usine/agents",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The usine agent layer: Pi parent adapter, subagents extension, team roster and brain specs.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"repository": {
|
|
7
|
-
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/basaltbytes/usine.git",
|
|
9
|
+
"directory": "packages/agents"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./pi": {
|
|
22
|
+
"types": "./dist/pi/index.d.ts",
|
|
23
|
+
"default": "./dist/pi/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.251",
|
|
31
|
+
"@earendil-works/pi-coding-agent": "0.84.4",
|
|
32
|
+
"typebox": "1.3.7",
|
|
33
|
+
"@usine/core": "0.1.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@effect/platform-node": "4.0.0-rc.111",
|
|
37
|
+
"@effect/vitest": "4.0.0-rc.111",
|
|
38
|
+
"@pwrdrvr/codex-app-server-protocol": "0.144.0",
|
|
39
|
+
"effect": "4.0.0-rc.111",
|
|
40
|
+
"typescript": "7.0.2",
|
|
41
|
+
"vitest": "4.1.11",
|
|
42
|
+
"@usine/tsconfig": "0.0.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"effect": "4.0.0-rc.111"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=22"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc -b",
|
|
52
|
+
"check": "tsc -p tsconfig.check.json && tsc -p tsconfig.conformance.json",
|
|
53
|
+
"test": "vitest run --exclude 'test/integration/**'",
|
|
54
|
+
"test:integration:codex": "vitest run test/integration/codex.test.ts",
|
|
55
|
+
"test:integration:pi": "vitest run test/integration/pi.test.ts"
|
|
56
|
+
}
|
|
57
|
+
}
|