neurastream 0.3.26 → 0.3.28
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/package.json +1 -1
- package/src/adapters/agy/adapter.ts +661 -0
- package/src/adapters/claude/adapter.ts +545 -0
- package/src/adapters/codex/adapter.ts +589 -0
- package/src/adapters/hook-bridge.ts +429 -0
- package/src/adapters/index.ts +44 -6
- package/src/adapters/omp/adapter.ts +8 -0
- package/src/adapters/omp/index.ts +24 -9
- package/src/adapters/omp/launch.ts +5 -1
- package/src/adapters/omp/limit-wake.ts +4 -18
- package/src/adapters/omp/sessions.ts +6 -2
- package/src/adapters/omp/types.ts +19 -2
- package/src/adapters/shared.ts +1318 -0
- package/src/cli/commands.ts +109 -6
- package/src/cli/config-set.ts +26 -4
- package/src/cli/dispatch.ts +80 -7
- package/src/cli/recall.ts +5 -2
- package/src/cli/spawn.ts +629 -0
- package/src/core/adapter.ts +53 -0
- package/src/core/config-edit.ts +9 -1
- package/src/core/config.ts +79 -0
- package/src/core/guards/spawn.ts +47 -10
- package/src/core/guards/state.ts +23 -0
- package/src/core/guards/stop.ts +10 -8
- package/src/core/guards/tool.ts +65 -9
- package/src/core/provider-state.ts +406 -19
- package/src/core/runner.ts +223 -0
- package/src/runners/herdr/index.ts +293 -0
- package/src/runners/index.ts +36 -0
- package/templates/AGENTS.md +1 -0
- package/templates/config.yml +10 -1
|
@@ -376,8 +376,12 @@ export function ompRunSource(root: string, cfg: Config): RunSource {
|
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
function ompSessionsRoot(cfg: Config): string {
|
|
380
|
+
return ((!cfg.adapter?.name || cfg.adapter.name === "omp") && cfg.adapter?.sessions) || join(cfg.paths.home, ".omp", "agent", "sessions");
|
|
381
|
+
}
|
|
382
|
+
|
|
379
383
|
export function defaultRunSource(cfg: Config): RunSource {
|
|
380
|
-
return ompRunSource(
|
|
384
|
+
return ompRunSource(ompSessionsRoot(cfg), cfg);
|
|
381
385
|
}
|
|
382
386
|
|
|
383
387
|
/** The text of a user message: a string, or the text parts joined. */
|
|
@@ -444,7 +448,7 @@ export function ompOwnerTurns(root: string, since: number): OwnerTurn[] {
|
|
|
444
448
|
}
|
|
445
449
|
|
|
446
450
|
export function defaultOwnerTurns(cfg: Config, since: number): OwnerTurn[] {
|
|
447
|
-
return ompOwnerTurns(
|
|
451
|
+
return ompOwnerTurns(ompSessionsRoot(cfg), since);
|
|
448
452
|
}
|
|
449
453
|
|
|
450
454
|
/**
|
|
@@ -89,11 +89,17 @@ export function asCtx(v: unknown): HostCtx {
|
|
|
89
89
|
// The agent envelope only ever carries kind/id strings (original extensions read just those);
|
|
90
90
|
// cast fixes the envelope, every field below is checked before use.
|
|
91
91
|
const agent = r.agent as { kind?: unknown; id?: unknown } | null | undefined;
|
|
92
|
-
const
|
|
93
|
-
|
|
92
|
+
const hasEnvelope = agent !== null && agent !== undefined;
|
|
93
|
+
const subEnv = process.env.NEURASTREAM_ROLE === "sub";
|
|
94
|
+
const out: HostCtx = { hasAgent: hasEnvelope || subEnv };
|
|
95
|
+
if (hasEnvelope) {
|
|
94
96
|
if (typeof agent.kind === "string") out.kind = agent.kind;
|
|
95
97
|
if (typeof agent.id === "string") out.id = agent.id;
|
|
96
98
|
}
|
|
99
|
+
if (subEnv && (!hasEnvelope || out.kind === "main")) {
|
|
100
|
+
out.kind = "sub";
|
|
101
|
+
out.id = process.env.NEURASTREAM_AGENT_ID || "sub";
|
|
102
|
+
}
|
|
97
103
|
if (typeof r.cwd === "string") out.cwd = r.cwd;
|
|
98
104
|
// Harness-injected timer with the original main-guard signature (ctx.setInterval).
|
|
99
105
|
const interval = r.setInterval as ((cb: () => void, ms: number) => unknown) | undefined;
|
|
@@ -130,7 +136,18 @@ export function asRolloverCtx(v: unknown): RolloverCtx | null {
|
|
|
130
136
|
};
|
|
131
137
|
}
|
|
132
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Returns whether the current call context belongs to Main rather than a subagent.
|
|
141
|
+
* Always returns false when `NEURASTREAM_ROLE=sub` is active in the environment.
|
|
142
|
+
*
|
|
143
|
+
* Args:
|
|
144
|
+
* ctx (unknown): Untyped harness call context
|
|
145
|
+
*
|
|
146
|
+
* Returns:
|
|
147
|
+
* boolean: True when acting as Main
|
|
148
|
+
*/
|
|
133
149
|
export function isMain(ctx: unknown): boolean {
|
|
150
|
+
if (process.env.NEURASTREAM_ROLE === "sub") return false;
|
|
134
151
|
const c = asCtx(ctx);
|
|
135
152
|
return !c.hasAgent || c.kind === "main";
|
|
136
153
|
}
|