@unieai/rabi-subagent-spawn-in-process 0.2.1-rc.3 → 0.2.2-rc.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/locale/de.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/package.json +7 -4
- package/src/index.ts +59 -0
package/locale/de.json
ADDED
package/locale/es.json
ADDED
package/locale/fr.json
ADDED
package/locale/ja.json
ADDED
package/locale/pt.json
ADDED
package/locale/ru.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unieai/rabi-subagent-spawn-in-process",
|
|
3
3
|
"description": "In-process spawn subagent backend: runs a fresh child agent on ctx.agents",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2-rc.5",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -21,14 +21,17 @@
|
|
|
21
21
|
"locale/*.json",
|
|
22
22
|
"lib/index.js",
|
|
23
23
|
"lib/types/**/*.d.ts",
|
|
24
|
+
"lib/types/**/*.d.ts.map",
|
|
25
|
+
"lib/**/*.js.map",
|
|
26
|
+
"src",
|
|
24
27
|
"README.md"
|
|
25
28
|
],
|
|
26
29
|
"license": "MIT",
|
|
27
30
|
"peerDependencies": {
|
|
28
|
-
"@unieai/rabi-subagent": "0.2.
|
|
29
|
-
"@unieai/cordis": "4.0
|
|
31
|
+
"@unieai/rabi-subagent": "0.2.2-rc.5",
|
|
32
|
+
"@unieai/cordis": "4.1.0"
|
|
30
33
|
},
|
|
31
34
|
"dependencies": {
|
|
32
|
-
"@unieai/schemastery": "3.
|
|
35
|
+
"@unieai/schemastery": "3.19.0"
|
|
33
36
|
}
|
|
34
37
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-process SPAWN subagent backend: registers a {@link SubagentProvider} on
|
|
3
|
+
* `ctx.subagents` that runs each child as a fresh child {@link Agent} on the same cordis
|
|
4
|
+
* context (its own session, own system prompt, zero parent context). The cheapest transport,
|
|
5
|
+
* reusing the agent factory's quiescent teardown.
|
|
6
|
+
* @module @unieai/rabi-subagent-spawn-in-process
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Context } from '@unieai/cordis'
|
|
10
|
+
import z from '@unieai/schemastery'
|
|
11
|
+
import type {
|
|
12
|
+
ContinuableCreateSpec,
|
|
13
|
+
SubagentCapabilities,
|
|
14
|
+
SubagentProvider,
|
|
15
|
+
} from '@unieai/rabi-subagent'
|
|
16
|
+
|
|
17
|
+
export const name = 'subagent-spawn-in-process'
|
|
18
|
+
// `tools` is deliberately not injected: the child factory already provides it during setup,
|
|
19
|
+
// and adding it here would unnecessarily change this provider's apply timing.
|
|
20
|
+
export const inject = ['subagents']
|
|
21
|
+
|
|
22
|
+
/** Config: the registry name to register the provider under. */
|
|
23
|
+
export interface Config {
|
|
24
|
+
/** Provider name on `ctx.subagents` (default `spawn`). */
|
|
25
|
+
providerName: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Config: z<Config> = z.object({
|
|
29
|
+
providerName: z.string().default('spawn'),
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The spawn provider. Supports every start-time capability: `depthLimit` (it
|
|
34
|
+
* constructs the child, so it can enforce a recursion cap), `outputSchema`
|
|
35
|
+
* (the scoped structured runtime), `agentOptions` (merged over the parent
|
|
36
|
+
* route). The selected preset owns persona and tool composition.
|
|
37
|
+
*/
|
|
38
|
+
class SpawnInProcessProvider implements SubagentProvider {
|
|
39
|
+
readonly capabilities: SubagentCapabilities = {
|
|
40
|
+
agentOptions: true,
|
|
41
|
+
agentPreset: true,
|
|
42
|
+
outputSchema: true,
|
|
43
|
+
depthLimit: true,
|
|
44
|
+
}
|
|
45
|
+
// Context contract: a spawned child starts fresh — it never sees the parent conversation.
|
|
46
|
+
readonly inheritsParentContext = false
|
|
47
|
+
|
|
48
|
+
constructor(readonly name: string) {}
|
|
49
|
+
|
|
50
|
+
prepareContinuable(): Promise<ContinuableCreateSpec> {
|
|
51
|
+
// A spawned child starts fresh, so it contributes no seed; the continuation
|
|
52
|
+
// manager owns every later operation on it.
|
|
53
|
+
return Promise.resolve({})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function apply(ctx: Context, config: Config): void {
|
|
58
|
+
ctx.subagents.registerProvider(new SpawnInProcessProvider(config.providerName))
|
|
59
|
+
}
|