@femtomc/mu-agent 26.3.1 → 26.3.2
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/operator.d.ts.map +1 -1
- package/dist/operator.js +88 -12
- package/package.json +2 -2
package/dist/operator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAmB,MAAM,kBAAkB,CAAC;AAI5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAmB,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,MAAM,gCAAgC,GAAG;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,eAAe,GAAG,gCAAgC,CAAC;AACxD,KAAK,eAAe,GAAG,gCAAgC,CAAC;AAQxD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAgCxC,CAAC;AACH,MAAM,MAAM,uBAAuB,G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AC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CACrD,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC;AAgG1C,qBAAa,0BAA2B,YAAW,wBAAwB;;gBAkBvD,IAAI,GAAE,8BAAmC;IAgO/C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBjD,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAyIlF,OAAO,IAAI,IAAI;CAKtB"}
|
package/dist/operator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UiDocSchema, normalizeUiDocs } from "@femtomc/mu-core";
|
|
2
2
|
import { appendJsonl, getStorePaths } from "@femtomc/mu-core/node";
|
|
3
3
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
4
|
-
import { dirname, join } from "node:path";
|
|
4
|
+
import { dirname, isAbsolute, join } from "node:path";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { CommandContextResolver } from "./command_context.js";
|
|
7
7
|
import { createMuSession } from "./session_factory.js";
|
|
@@ -255,6 +255,13 @@ function nonEmptyString(value) {
|
|
|
255
255
|
const trimmed = value.trim();
|
|
256
256
|
return trimmed.length > 0 ? trimmed : null;
|
|
257
257
|
}
|
|
258
|
+
function autonomousSessionIdOverride(metadata) {
|
|
259
|
+
const source = nonEmptyString(metadata.source);
|
|
260
|
+
if (source !== "autonomous_ingress") {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
return nonEmptyString(metadata.operator_session_id);
|
|
264
|
+
}
|
|
258
265
|
function autonomousTurnEnvironment(metadata) {
|
|
259
266
|
const source = nonEmptyString(metadata.source);
|
|
260
267
|
if (source !== "autonomous_ingress") {
|
|
@@ -281,6 +288,38 @@ function autonomousTurnEnvironment(metadata) {
|
|
|
281
288
|
}
|
|
282
289
|
return out;
|
|
283
290
|
}
|
|
291
|
+
function resolveRepoPath(repoRoot, candidate) {
|
|
292
|
+
return isAbsolute(candidate) ? candidate : join(repoRoot, candidate);
|
|
293
|
+
}
|
|
294
|
+
function autonomousOperatorSessionOverrides(metadata, repoRoot) {
|
|
295
|
+
const source = nonEmptyString(metadata.source);
|
|
296
|
+
if (source !== "autonomous_ingress") {
|
|
297
|
+
return {};
|
|
298
|
+
}
|
|
299
|
+
const provider = nonEmptyString(metadata.operator_provider);
|
|
300
|
+
const model = nonEmptyString(metadata.operator_model);
|
|
301
|
+
const thinking = nonEmptyString(metadata.operator_thinking);
|
|
302
|
+
const sessionFileRaw = nonEmptyString(metadata.operator_session_file);
|
|
303
|
+
const sessionDirRaw = nonEmptyString(metadata.operator_session_dir);
|
|
304
|
+
const sessionFile = sessionFileRaw ? resolveRepoPath(repoRoot, sessionFileRaw) : undefined;
|
|
305
|
+
const sessionDir = sessionDirRaw ? resolveRepoPath(repoRoot, sessionDirRaw) : undefined;
|
|
306
|
+
return {
|
|
307
|
+
...(provider ? { provider } : {}),
|
|
308
|
+
...(model ? { model } : {}),
|
|
309
|
+
...(thinking ? { thinking } : {}),
|
|
310
|
+
...(sessionFile ? { sessionFile } : {}),
|
|
311
|
+
...(sessionDir ? { sessionDir } : {}),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function operatorSessionProfileKey(opts) {
|
|
315
|
+
return JSON.stringify({
|
|
316
|
+
provider: opts.provider ?? null,
|
|
317
|
+
model: opts.model ?? null,
|
|
318
|
+
thinking: opts.thinking ?? null,
|
|
319
|
+
sessionFile: opts.sessionFile ?? null,
|
|
320
|
+
sessionDir: opts.sessionDir ?? null,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
284
323
|
function isUiToolName(toolName) {
|
|
285
324
|
const normalized = toolName.trim().toLowerCase();
|
|
286
325
|
return normalized === "mu_ui";
|
|
@@ -411,6 +450,10 @@ export class MessagingOperatorRuntime {
|
|
|
411
450
|
this.#conversationSessionStore = opts.conversationSessionStore ?? null;
|
|
412
451
|
}
|
|
413
452
|
async #resolveSessionId(inbound, binding) {
|
|
453
|
+
const explicitSessionId = autonomousSessionIdOverride(inbound.metadata);
|
|
454
|
+
if (explicitSessionId) {
|
|
455
|
+
return explicitSessionId;
|
|
456
|
+
}
|
|
414
457
|
const key = conversationKey(inbound, binding);
|
|
415
458
|
const existing = this.#sessionByConversation.get(key);
|
|
416
459
|
if (existing) {
|
|
@@ -717,10 +760,24 @@ export class PiMessagingOperatorBackend {
|
|
|
717
760
|
}
|
|
718
761
|
this.#activePromptCountsBySession.set(sessionId, current - 1);
|
|
719
762
|
}
|
|
720
|
-
#sessionPersistence(repoRoot, sessionId) {
|
|
763
|
+
#sessionPersistence(repoRoot, sessionId, overrides) {
|
|
721
764
|
if (!this.#persistSessions) {
|
|
722
765
|
return undefined;
|
|
723
766
|
}
|
|
767
|
+
if (overrides.sessionFile) {
|
|
768
|
+
return {
|
|
769
|
+
mode: "open",
|
|
770
|
+
sessionDir: overrides.sessionDir,
|
|
771
|
+
sessionFile: overrides.sessionFile,
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
if (overrides.sessionDir) {
|
|
775
|
+
return {
|
|
776
|
+
mode: "open",
|
|
777
|
+
sessionDir: overrides.sessionDir,
|
|
778
|
+
sessionFile: join(overrides.sessionDir, `${sessionFileStem(sessionId)}.jsonl`),
|
|
779
|
+
};
|
|
780
|
+
}
|
|
724
781
|
const sessionDir = this.#sessionDirForRepoRoot(repoRoot);
|
|
725
782
|
const sessionFile = join(sessionDir, `${sessionFileStem(sessionId)}.jsonl`);
|
|
726
783
|
return {
|
|
@@ -729,15 +786,25 @@ export class PiMessagingOperatorBackend {
|
|
|
729
786
|
sessionFile,
|
|
730
787
|
};
|
|
731
788
|
}
|
|
732
|
-
async #createSession(repoRoot, sessionId, nowMs) {
|
|
789
|
+
async #createSession(repoRoot, sessionId, nowMs, overrides) {
|
|
790
|
+
const provider = overrides.provider ?? this.#provider;
|
|
791
|
+
const model = overrides.model ?? this.#model;
|
|
792
|
+
const thinking = overrides.thinking ?? this.#thinking;
|
|
793
|
+
const profileKey = operatorSessionProfileKey({
|
|
794
|
+
provider,
|
|
795
|
+
model,
|
|
796
|
+
thinking,
|
|
797
|
+
sessionFile: overrides.sessionFile,
|
|
798
|
+
sessionDir: overrides.sessionDir,
|
|
799
|
+
});
|
|
733
800
|
const session = await this.#sessionFactory({
|
|
734
801
|
cwd: repoRoot,
|
|
735
802
|
systemPrompt: this.#systemPrompt,
|
|
736
|
-
provider
|
|
737
|
-
model
|
|
738
|
-
thinking
|
|
803
|
+
provider,
|
|
804
|
+
model,
|
|
805
|
+
thinking,
|
|
739
806
|
extensionPaths: this.#extensionPaths,
|
|
740
|
-
session: this.#sessionPersistence(repoRoot, sessionId),
|
|
807
|
+
session: this.#sessionPersistence(repoRoot, sessionId, overrides),
|
|
741
808
|
bashToolOptions: {
|
|
742
809
|
spawnHook: (context) => {
|
|
743
810
|
const turnEnv = this.#autonomousTurnEnvBySession.get(sessionId);
|
|
@@ -770,20 +837,28 @@ export class PiMessagingOperatorBackend {
|
|
|
770
837
|
repoRoot,
|
|
771
838
|
createdAtMs: nowMs,
|
|
772
839
|
lastUsedAtMs: nowMs,
|
|
840
|
+
profileKey,
|
|
773
841
|
};
|
|
774
842
|
}
|
|
775
|
-
async #resolveSession(sessionId, repoRoot) {
|
|
843
|
+
async #resolveSession(sessionId, repoRoot, overrides) {
|
|
776
844
|
const nowMs = Math.trunc(this.#nowMs());
|
|
777
845
|
this.#pruneSessions(nowMs);
|
|
846
|
+
const requestedProfileKey = operatorSessionProfileKey({
|
|
847
|
+
provider: overrides.provider ?? this.#provider,
|
|
848
|
+
model: overrides.model ?? this.#model,
|
|
849
|
+
thinking: overrides.thinking ?? this.#thinking,
|
|
850
|
+
sessionFile: overrides.sessionFile,
|
|
851
|
+
sessionDir: overrides.sessionDir,
|
|
852
|
+
});
|
|
778
853
|
const existing = this.#sessions.get(sessionId);
|
|
779
|
-
if (existing && existing.repoRoot === repoRoot) {
|
|
854
|
+
if (existing && existing.repoRoot === repoRoot && existing.profileKey === requestedProfileKey) {
|
|
780
855
|
existing.lastUsedAtMs = nowMs;
|
|
781
856
|
return existing;
|
|
782
857
|
}
|
|
783
|
-
if (existing
|
|
858
|
+
if (existing) {
|
|
784
859
|
this.#disposeSession(sessionId);
|
|
785
860
|
}
|
|
786
|
-
const created = await this.#createSession(repoRoot, sessionId, nowMs);
|
|
861
|
+
const created = await this.#createSession(repoRoot, sessionId, nowMs, overrides);
|
|
787
862
|
this.#sessions.set(sessionId, created);
|
|
788
863
|
this.#pruneSessions(nowMs);
|
|
789
864
|
return created;
|
|
@@ -835,7 +910,8 @@ export class PiMessagingOperatorBackend {
|
|
|
835
910
|
}
|
|
836
911
|
}
|
|
837
912
|
async runTurn(input) {
|
|
838
|
-
const
|
|
913
|
+
const overrides = autonomousOperatorSessionOverrides(input.inbound.metadata, input.inbound.repo_root);
|
|
914
|
+
const sessionRecord = await this.#resolveSession(input.sessionId, input.inbound.repo_root, overrides);
|
|
839
915
|
const session = sessionRecord.session;
|
|
840
916
|
let assistantText = "";
|
|
841
917
|
let capturedCommand = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@femtomc/mu-agent",
|
|
3
|
-
"version": "26.3.
|
|
3
|
+
"version": "26.3.2",
|
|
4
4
|
"description": "Shared operator runtime for mu assistant sessions and serve extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mu",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"themes/**"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@femtomc/mu-core": "26.3.
|
|
27
|
+
"@femtomc/mu-core": "26.3.2",
|
|
28
28
|
"@mariozechner/pi-agent-core": "^0.54.2",
|
|
29
29
|
"@mariozechner/pi-ai": "^0.54.2",
|
|
30
30
|
"@mariozechner/pi-coding-agent": "^0.54.2",
|