@agent-marshal/marshal-prime-agent 0.49.3 → 0.49.5
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/README.md +5 -2
- package/package.json +3 -2
- package/src/index.ts +14 -0
- package/src/runtime.ts +19 -0
package/README.md
CHANGED
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
`marshal-pi` package and targets Prime Agent's conversation lifecycle and canonical
|
|
6
6
|
session identities.
|
|
7
7
|
|
|
8
|
-
The extension runs inside each Prime Agent conversation.
|
|
8
|
+
The extension runs inside each top-level Prime Agent conversation. Prime Agent
|
|
9
|
+
RLM sub-agents stay part of their parent's Marshal session and are not added to the
|
|
10
|
+
roster independently. It:
|
|
9
11
|
|
|
10
|
-
- registers the conversation on the Marshal roster using Prime Agent's
|
|
12
|
+
- registers the top-level conversation on the Marshal roster using Prime Agent's
|
|
13
|
+
session ID;
|
|
11
14
|
- exposes native `marshal_*` tools to the model;
|
|
12
15
|
- subscribes to Marshal's live notification stream; and
|
|
13
16
|
- injects incoming direct messages with
|
package/package.json
CHANGED
|
@@ -46,8 +46,9 @@
|
|
|
46
46
|
"url": "https://github.com/ignition-is-go/marshal"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"gen": "cargo run -p marshal-entities --no-default-features --features codegen --bin typegen -- src/generated"
|
|
49
|
+
"gen": "cargo run -p marshal-entities --no-default-features --features codegen --bin typegen -- src/generated",
|
|
50
|
+
"test": "bun test"
|
|
50
51
|
},
|
|
51
52
|
"type": "module",
|
|
52
|
-
"version": "0.49.
|
|
53
|
+
"version": "0.49.5"
|
|
53
54
|
}
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { Type } from "typebox";
|
|
|
25
25
|
import { MarshalDaemon } from "./daemon.ts";
|
|
26
26
|
import { resolveIdentity, type Identity } from "./identity.ts";
|
|
27
27
|
import type { NotifyChannelMeta, SessionItem } from "./entities.ts";
|
|
28
|
+
import { shouldRegisterPrimeAgentSession } from "./runtime.ts";
|
|
28
29
|
|
|
29
30
|
const DEFAULT_ADDRESS = "ws://localhost:6155";
|
|
30
31
|
|
|
@@ -218,6 +219,15 @@ async function init(pi: ExtensionAPI) {
|
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
pi.on("session_start", async (_event, ctx) => {
|
|
222
|
+
// Prime Agent loads extensions for RLM children too. The persisted header's
|
|
223
|
+
// RLM depth is the canonical distinction; parentSession alone is not enough
|
|
224
|
+
// because ordinary top-level forks also have a parent.
|
|
225
|
+
const header = ctx.sessionManager.getHeader() as { rlmDepth?: unknown } | null;
|
|
226
|
+
if (!shouldRegisterPrimeAgentSession(header)) {
|
|
227
|
+
log("RLM sub-agent detected; skipping Marshal session registration");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
221
231
|
sessionCtx = ctx;
|
|
222
232
|
sessionId = ctx.sessionManager.getSessionId();
|
|
223
233
|
|
|
@@ -309,6 +319,10 @@ async function init(pi: ExtensionAPI) {
|
|
|
309
319
|
// ── Per-turn context injection ─────────────────────────────────────────
|
|
310
320
|
|
|
311
321
|
pi.on("before_agent_start", async (event, _ctx) => {
|
|
322
|
+
// A skipped RLM child has no Marshal identity. Do not tell it that it is
|
|
323
|
+
// connected or inject any coordination context intended for its parent.
|
|
324
|
+
if (!sessionId) return;
|
|
325
|
+
|
|
312
326
|
const result: { systemPrompt?: string; message?: { customType: string; content: string; display: boolean } } = {};
|
|
313
327
|
|
|
314
328
|
// Add marshal system prompt context (once per turn, before the LLM call).
|
package/src/runtime.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The small part of Prime Agent's session header used for registration. */
|
|
2
|
+
export interface PrimeAgentSessionHeader {
|
|
3
|
+
rlmDepth?: unknown;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function isPositiveIntegerDepth(value: unknown): boolean {
|
|
8
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Return whether a canonical Prime Agent session depth belongs to an RLM child. */
|
|
12
|
+
export function isPrimeAgentSubagent(rlmDepth: unknown): boolean {
|
|
13
|
+
return isPositiveIntegerDepth(rlmDepth);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Public-API guard for the session_start registration boundary. */
|
|
17
|
+
export function shouldRegisterPrimeAgentSession(header: PrimeAgentSessionHeader | null): boolean {
|
|
18
|
+
return !isPrimeAgentSubagent(header?.rlmDepth);
|
|
19
|
+
}
|