@femtomc/mu-agent 26.2.57 → 26.2.58
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/dist/{pi_sdk_backend.d.ts → backend.d.ts} +22 -6
- package/dist/backend.d.ts.map +1 -0
- package/dist/{pi_sdk_backend.js → backend.js} +31 -6
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/session_factory.js +1 -1
- package/package.json +2 -2
- package/dist/pi_backend.d.ts +0 -20
- package/dist/pi_backend.d.ts.map +0 -1
- package/dist/pi_backend.js +0 -27
- package/dist/pi_sdk_backend.d.ts.map +0 -1
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import type { Model } from "@mariozechner/pi-ai";
|
|
2
2
|
import { AuthStorage, DefaultResourceLoader, SettingsManager } from "@mariozechner/pi-coding-agent";
|
|
3
|
-
import type {
|
|
3
|
+
import type { MuRole } from "./mu_roles.js";
|
|
4
|
+
export type BackendRunOpts = {
|
|
5
|
+
issueId: string;
|
|
6
|
+
role: MuRole;
|
|
7
|
+
systemPrompt: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
provider: string;
|
|
10
|
+
model: string;
|
|
11
|
+
thinking: string;
|
|
12
|
+
cwd: string;
|
|
13
|
+
logSuffix: string;
|
|
14
|
+
onLine?: (line: string) => void;
|
|
15
|
+
teePath?: string;
|
|
16
|
+
};
|
|
17
|
+
export interface BackendRunner {
|
|
18
|
+
run(opts: BackendRunOpts): Promise<number>;
|
|
19
|
+
}
|
|
20
|
+
export declare function streamHasError(line: string): boolean;
|
|
4
21
|
/**
|
|
5
22
|
* Resolve a bare model ID (e.g. "gpt-5.3-codex") to a pi-ai Model object.
|
|
6
23
|
*
|
|
@@ -9,12 +26,11 @@ import type { BackendRunner, BackendRunOpts } from "./pi_backend.js";
|
|
|
9
26
|
*/
|
|
10
27
|
export declare function resolveModel(modelId: string, authStorage: AuthStorage, providerConstraint?: string): Model<any> | undefined;
|
|
11
28
|
/**
|
|
12
|
-
* In-process backend using the
|
|
29
|
+
* In-process backend using the SDK.
|
|
13
30
|
*
|
|
14
|
-
*
|
|
15
|
-
* `createAgentSession` from `@mariozechner/pi-coding-agent`.
|
|
31
|
+
* Uses `createAgentSession` from `@mariozechner/pi-coding-agent`.
|
|
16
32
|
*/
|
|
17
|
-
export declare class
|
|
33
|
+
export declare class SdkBackend implements BackendRunner {
|
|
18
34
|
run(opts: BackendRunOpts): Promise<number>;
|
|
19
35
|
}
|
|
20
36
|
export type CreateMuResourceLoaderOpts = {
|
|
@@ -26,4 +42,4 @@ export type CreateMuResourceLoaderOpts = {
|
|
|
26
42
|
additionalSkillPaths?: string[];
|
|
27
43
|
};
|
|
28
44
|
export declare function createMuResourceLoader(opts: CreateMuResourceLoaderOpts): DefaultResourceLoader;
|
|
29
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACN,WAAW,EAOX,qBAAqB,EAErB,eAAe,EACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC7B,GAAG,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA4BpD;AAGD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,WAAW,EACxB,kBAAkB,CAAC,EAAE,MAAM,GACzB,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CA6BxB;AAED;;;;GAIG;AACH,qBAAa,UAAW,YAAW,aAAa;IACzC,GAAG,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAiGhD;AAGD,MAAM,MAAM,0BAA0B,GAAG;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,0BAA0B,GAAG,qBAAqB,CAuB9F"}
|
|
@@ -3,7 +3,33 @@ import { mkdir, open } from "node:fs/promises";
|
|
|
3
3
|
import { basename, dirname, join } from "node:path";
|
|
4
4
|
import { getModels, getProviders } from "@mariozechner/pi-ai";
|
|
5
5
|
import { AuthStorage, createAgentSession, createBashTool, createEditTool, createReadTool, createWriteTool, DefaultResourceLoader, SessionManager, SettingsManager, } from "@mariozechner/pi-coding-agent";
|
|
6
|
-
|
|
6
|
+
export function streamHasError(line) {
|
|
7
|
+
let event;
|
|
8
|
+
try {
|
|
9
|
+
event = JSON.parse(line);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const etype = event?.type;
|
|
15
|
+
if (etype === "message_update") {
|
|
16
|
+
const assistantEvent = event?.assistantMessageEvent;
|
|
17
|
+
if (assistantEvent && typeof assistantEvent === "object" && assistantEvent.type === "error") {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (etype === "message_end") {
|
|
22
|
+
const message = event?.message;
|
|
23
|
+
if (!message || typeof message !== "object") {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (message.role !== "assistant") {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return message.stopReason === "error" || message.stopReason === "aborted";
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
7
33
|
/**
|
|
8
34
|
* Resolve a bare model ID (e.g. "gpt-5.3-codex") to a pi-ai Model object.
|
|
9
35
|
*
|
|
@@ -37,12 +63,11 @@ export function resolveModel(modelId, authStorage, providerConstraint) {
|
|
|
37
63
|
return fallback;
|
|
38
64
|
}
|
|
39
65
|
/**
|
|
40
|
-
* In-process backend using the
|
|
66
|
+
* In-process backend using the SDK.
|
|
41
67
|
*
|
|
42
|
-
*
|
|
43
|
-
* `createAgentSession` from `@mariozechner/pi-coding-agent`.
|
|
68
|
+
* Uses `createAgentSession` from `@mariozechner/pi-coding-agent`.
|
|
44
69
|
*/
|
|
45
|
-
export class
|
|
70
|
+
export class SdkBackend {
|
|
46
71
|
async run(opts) {
|
|
47
72
|
const authStorage = new AuthStorage();
|
|
48
73
|
const model = resolveModel(opts.model, authStorage, opts.provider);
|
|
@@ -97,7 +122,7 @@ export class PiSdkBackend {
|
|
|
97
122
|
// Subscribe to events — serialize to JSONL for tee and error detection.
|
|
98
123
|
const unsub = session.subscribe((event) => {
|
|
99
124
|
const line = JSON.stringify(event);
|
|
100
|
-
if (
|
|
125
|
+
if (streamHasError(line)) {
|
|
101
126
|
sawError = true;
|
|
102
127
|
}
|
|
103
128
|
// onLine gets everything (CLI needs deltas for live rendering).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
export * from "./backend.js";
|
|
1
2
|
export * from "./command_context.js";
|
|
2
3
|
export { DEFAULT_SOUL_PROMPT, appendSharedSoul, loadBundledPrompt } from "./default_prompts.js";
|
|
3
4
|
export * from "./extensions/index.js";
|
|
4
5
|
export * from "./operator.js";
|
|
5
6
|
export * from "./mu_roles.js";
|
|
6
|
-
export * from "./pi_backend.js";
|
|
7
|
-
export * from "./pi_sdk_backend.js";
|
|
8
7
|
export * from "./prompt.js";
|
|
9
8
|
export * from "./session_factory.js";
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAChG,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAChG,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
export * from "./backend.js";
|
|
1
2
|
export * from "./command_context.js";
|
|
2
3
|
export { DEFAULT_SOUL_PROMPT, appendSharedSoul, loadBundledPrompt } from "./default_prompts.js";
|
|
3
4
|
export * from "./extensions/index.js";
|
|
4
5
|
export * from "./operator.js";
|
|
5
6
|
export * from "./mu_roles.js";
|
|
6
|
-
export * from "./pi_backend.js";
|
|
7
|
-
export * from "./pi_sdk_backend.js";
|
|
8
7
|
export * from "./prompt.js";
|
|
9
8
|
export * from "./session_factory.js";
|
package/dist/session_factory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createBashTool, createEditTool, createReadTool, createWriteTool, } from "@mariozechner/pi-coding-agent";
|
|
2
|
-
import { createMuResourceLoader, resolveModel } from "./
|
|
2
|
+
import { createMuResourceLoader, resolveModel } from "./backend.js";
|
|
3
3
|
export async function createMuSession(opts) {
|
|
4
4
|
const { AuthStorage, createAgentSession, SessionManager, SettingsManager } = await import("@mariozechner/pi-coding-agent");
|
|
5
5
|
const authStorage = new AuthStorage();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@femtomc/mu-agent",
|
|
3
|
-
"version": "26.2.
|
|
3
|
+
"version": "26.2.58",
|
|
4
4
|
"description": "Shared agent runtime for mu chat, orchestration roles, and serve extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mu",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"prompts/**"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@femtomc/mu-core": "
|
|
26
|
+
"@femtomc/mu-core": "26.2.57",
|
|
27
27
|
"@mariozechner/pi-agent-core": "^0.52.12",
|
|
28
28
|
"@mariozechner/pi-ai": "^0.52.12",
|
|
29
29
|
"@mariozechner/pi-coding-agent": "^0.52.12",
|
package/dist/pi_backend.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { MuRole } from "./mu_roles.js";
|
|
2
|
-
export type BackendRunOpts = {
|
|
3
|
-
issueId: string;
|
|
4
|
-
role: MuRole;
|
|
5
|
-
systemPrompt: string;
|
|
6
|
-
prompt: string;
|
|
7
|
-
provider: string;
|
|
8
|
-
model: string;
|
|
9
|
-
thinking: string;
|
|
10
|
-
cwd: string;
|
|
11
|
-
cli: string;
|
|
12
|
-
logSuffix: string;
|
|
13
|
-
onLine?: (line: string) => void;
|
|
14
|
-
teePath?: string;
|
|
15
|
-
};
|
|
16
|
-
export interface BackendRunner {
|
|
17
|
-
run(opts: BackendRunOpts): Promise<number>;
|
|
18
|
-
}
|
|
19
|
-
export declare function piStreamHasError(line: string): boolean;
|
|
20
|
-
//# sourceMappingURL=pi_backend.d.ts.map
|
package/dist/pi_backend.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pi_backend.d.ts","sourceRoot":"","sources":["../src/pi_backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC7B,GAAG,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA4BtD"}
|
package/dist/pi_backend.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export function piStreamHasError(line) {
|
|
2
|
-
let event;
|
|
3
|
-
try {
|
|
4
|
-
event = JSON.parse(line);
|
|
5
|
-
}
|
|
6
|
-
catch {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
const etype = event?.type;
|
|
10
|
-
if (etype === "message_update") {
|
|
11
|
-
const assistantEvent = event?.assistantMessageEvent;
|
|
12
|
-
if (assistantEvent && typeof assistantEvent === "object" && assistantEvent.type === "error") {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (etype === "message_end") {
|
|
17
|
-
const message = event?.message;
|
|
18
|
-
if (!message || typeof message !== "object") {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
if (message.role !== "assistant") {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
return message.stopReason === "error" || message.stopReason === "aborted";
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pi_sdk_backend.d.ts","sourceRoot":"","sources":["../src/pi_sdk_backend.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACN,WAAW,EAOX,qBAAqB,EAErB,eAAe,EACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGrE;;;;;GAKG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,WAAW,EACxB,kBAAkB,CAAC,EAAE,MAAM,GACzB,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CA6BxB;AAED;;;;;GAKG;AACH,qBAAa,YAAa,YAAW,aAAa;IAC3C,GAAG,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAiGhD;AAED,MAAM,MAAM,0BAA0B,GAAG;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,0BAA0B,GAAG,qBAAqB,CAuB9F"}
|