@grackle-ai/plugin-core 0.135.0 → 0.135.1

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/index.d.ts CHANGED
@@ -12,6 +12,8 @@ export type { OrphanPhaseDeps } from "./orphan-phase.js";
12
12
  export { lifecycleCleanupPhase } from "./lifecycle-cleanup.js";
13
13
  export { createEnvironmentReconciliationPhase } from "./environment-reconciliation.js";
14
14
  export type { EnvironmentReconciliationDeps } from "./environment-reconciliation.js";
15
+ export { createSubagentReconciliationPhase } from "./subagent-reconciliation.js";
16
+ export type { SubagentReconciliationDeps } from "./subagent-reconciliation.js";
15
17
  export { setLoadedPluginNames, PLUGIN_REGISTRY } from "./plugin-registry.js";
16
18
  export type { PluginRegistryEntry } from "./plugin-registry.js";
17
19
  export { killSessionAndCleanup } from "./grpc-shared.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAA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,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AACvF,YAAY,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACjF,YAAY,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAG/E,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC7E,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ export { createDispatchPhase } from "./dispatch-phase.js";
11
11
  export { createOrphanPhase } from "./orphan-phase.js";
12
12
  export { lifecycleCleanupPhase } from "./lifecycle-cleanup.js";
13
13
  export { createEnvironmentReconciliationPhase } from "./environment-reconciliation.js";
14
+ export { createSubagentReconciliationPhase } from "./subagent-reconciliation.js";
14
15
  // ─── Plugin Registry ────────────────────────────────────────
15
16
  export { setLoadedPluginNames, PLUGIN_REGISTRY } from "./plugin-registry.js";
16
17
  // ─── Handler Utilities ──────────────────────────────────────
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAGnE,+DAA+D;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AAGvF,+DAA+D;AAC/D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG7E,+DAA+D;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,+DAA+D;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,+DAA+D;AAC/D,OAAO,EAAE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BAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Subagent reconciliation phase (#1386) — reaps stranded RUNNING subagent
3
+ * children left behind by #1075.
4
+ *
5
+ * A materialized subagent child (`runtime="subagent"`) is only ever closed
6
+ * through its parent session's event stream. A background/polled child (Copilot
7
+ * `task` + `read_agent`) whose parent stream ends before a terminal poll lands is
8
+ * deliberately NOT interrupted by the stream's `finally` block — so it can be
9
+ * left `RUNNING` forever.
10
+ *
11
+ * Once the parent session reaches a terminal state, its stream has ended and the
12
+ * child can never be updated again (the parent stream is the child's only
13
+ * mutator), so the child is definitively stranded. This phase interrupts those
14
+ * children. A merely idle/running parent (still alive) or a SUSPENDED parent
15
+ * (recoverable — its resumed stream may still legitimately close the child) is
16
+ * left untouched.
17
+ *
18
+ * @module
19
+ */
20
+ import type { SessionRow } from "@grackle-ai/database";
21
+ import type { ReconciliationPhase } from "@grackle-ai/core";
22
+ /** Dependencies injected into the subagent reconciliation phase for testability. */
23
+ export interface SubagentReconciliationDeps {
24
+ /** List all materialized subagent child sessions currently in RUNNING. */
25
+ listRunningSubagentChildren: () => SessionRow[];
26
+ /** Resolve a session by id (used to look up each child's parent). */
27
+ getSession: (id: string) => SessionRow | undefined;
28
+ /** Mark a stranded child interrupted (terminal). Idempotent. */
29
+ interruptChildSession: (childSessionId: string) => void;
30
+ }
31
+ /**
32
+ * Create the subagent reconciliation phase.
33
+ *
34
+ * @param deps - Injected dependencies for testability.
35
+ * @returns A ReconciliationPhase that can be registered with the ReconciliationManager.
36
+ */
37
+ export declare function createSubagentReconciliationPhase(deps: SubagentReconciliationDeps): ReconciliationPhase;
38
+ //# sourceMappingURL=subagent-reconciliation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent-reconciliation.d.ts","sourceRoot":"","sources":["../src/subagent-reconciliation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,oFAAoF;AACpF,MAAM,WAAW,0BAA0B;IACzC,0EAA0E;IAC1E,2BAA2B,EAAE,MAAM,UAAU,EAAE,CAAC;IAChD,qEAAqE;IACrE,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;IACnD,gEAAgE;IAChE,qBAAqB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,0BAA0B,GAC/B,mBAAmB,CAsCrB"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Subagent reconciliation phase (#1386) — reaps stranded RUNNING subagent
3
+ * children left behind by #1075.
4
+ *
5
+ * A materialized subagent child (`runtime="subagent"`) is only ever closed
6
+ * through its parent session's event stream. A background/polled child (Copilot
7
+ * `task` + `read_agent`) whose parent stream ends before a terminal poll lands is
8
+ * deliberately NOT interrupted by the stream's `finally` block — so it can be
9
+ * left `RUNNING` forever.
10
+ *
11
+ * Once the parent session reaches a terminal state, its stream has ended and the
12
+ * child can never be updated again (the parent stream is the child's only
13
+ * mutator), so the child is definitively stranded. This phase interrupts those
14
+ * children. A merely idle/running parent (still alive) or a SUSPENDED parent
15
+ * (recoverable — its resumed stream may still legitimately close the child) is
16
+ * left untouched.
17
+ *
18
+ * @module
19
+ */
20
+ import { TERMINAL_SESSION_STATUSES } from "@grackle-ai/common";
21
+ import { logger } from "@grackle-ai/core";
22
+ /**
23
+ * Create the subagent reconciliation phase.
24
+ *
25
+ * @param deps - Injected dependencies for testability.
26
+ * @returns A ReconciliationPhase that can be registered with the ReconciliationManager.
27
+ */
28
+ export function createSubagentReconciliationPhase(deps) {
29
+ return {
30
+ name: "subagent-reconciliation",
31
+ execute: async () => {
32
+ let interrupted = 0;
33
+ for (const child of deps.listRunningSubagentChildren()) {
34
+ const parent = child.parentSessionId ? deps.getSession(child.parentSessionId) : undefined;
35
+ const parentGone = parent === undefined;
36
+ const parentTerminal = parent !== undefined && TERMINAL_SESSION_STATUSES.has(parent.status);
37
+ // Leave the child be while the parent is alive (running/idle) or merely
38
+ // SUSPENDED (recoverable — a resumed stream may still close the child).
39
+ if (!parentGone && !parentTerminal) {
40
+ continue;
41
+ }
42
+ try {
43
+ deps.interruptChildSession(child.id);
44
+ interrupted++;
45
+ }
46
+ catch (err) {
47
+ logger.error({ err, childId: child.id, parentSessionId: child.parentSessionId }, "Subagent reconciliation: failed to interrupt stranded child");
48
+ }
49
+ }
50
+ if (interrupted > 0) {
51
+ logger.info({ interrupted }, "Subagent reconciliation: interrupted %d stranded child session(s)", interrupted);
52
+ }
53
+ },
54
+ };
55
+ }
56
+ //# sourceMappingURL=subagent-reconciliation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent-reconciliation.js","sourceRoot":"","sources":["../src/subagent-reconciliation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAa1C;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAC/C,IAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,WAAW,GAAG,CAAC,CAAC;YAEpB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,2BAA2B,EAAE,EAAE,CAAC;gBACvD,MAAM,MAAM,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBAC1F,MAAM,UAAU,GAAG,MAAM,KAAK,SAAS,CAAC;gBACxC,MAAM,cAAc,GAClB,MAAM,KAAK,SAAS,IAAI,yBAAyB,CAAC,GAAG,CAAC,MAAM,CAAC,MAAuB,CAAC,CAAC;gBAExF,wEAAwE;gBACxE,wEAAwE;gBACxE,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc,EAAE,CAAC;oBACnC,SAAS;gBACX,CAAC;gBAED,IAAI,CAAC;oBACH,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;oBACrC,WAAW,EAAE,CAAC;gBAChB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,CAAC,KAAK,CACV,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE,EAClE,6DAA6D,CAC9D,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CACT,EAAE,WAAW,EAAE,EACf,mEAAmE,EACnE,WAAW,CACZ,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grackle-ai/plugin-core",
3
- "version": "0.135.0",
3
+ "version": "0.135.1",
4
4
  "description": "Core plugin for Grackle — gRPC handlers, reconciliation phases, and event subscribers",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,14 +33,14 @@
33
33
  "pino": "^10.3.1",
34
34
  "ulid": "^2.3.0",
35
35
  "uuid": "^11.1.1",
36
- "@grackle-ai/auth": "0.135.0",
37
- "@grackle-ai/common": "0.135.0",
38
- "@grackle-ai/core": "0.135.0",
39
- "@grackle-ai/adapter-sdk": "0.135.0",
40
- "@grackle-ai/database": "0.135.0",
41
- "@grackle-ai/knowledge": "0.135.0",
42
- "@grackle-ai/prompt": "0.135.0",
43
- "@grackle-ai/plugin-sdk": "0.135.0"
36
+ "@grackle-ai/adapter-sdk": "0.135.1",
37
+ "@grackle-ai/core": "0.135.1",
38
+ "@grackle-ai/database": "0.135.1",
39
+ "@grackle-ai/common": "0.135.1",
40
+ "@grackle-ai/auth": "0.135.1",
41
+ "@grackle-ai/plugin-sdk": "0.135.1",
42
+ "@grackle-ai/knowledge": "0.135.1",
43
+ "@grackle-ai/prompt": "0.135.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@rushstack/heft": "1.2.7",