@bastani/atomic 0.5.10-0 → 0.5.11-0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/sdk/runtime/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EACV,kBAAkB,EAMlB,SAAS,EAET,YAAY,EAMb,MAAM,aAAa,CAAC;AAgErB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAS5C,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,iBAAiB;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA0HD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAKzC;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgB9E;AAMD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAyEf;AAcD,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAOvE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAkDrE;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/sdk/runtime/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EACV,kBAAkB,EAMlB,SAAS,EAET,YAAY,EAMb,MAAM,aAAa,CAAC;AAgErB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAS5C,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,iBAAiB;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA0HD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAKzC;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgB9E;AAMD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAyEf;AAcD,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAOvE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAkDrE;AAggBD,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAsJrD"}
|
package/package.json
CHANGED
|
@@ -839,6 +839,46 @@ function createSessionRunner(
|
|
|
839
839
|
sessionOpts,
|
|
840
840
|
);
|
|
841
841
|
|
|
842
|
+
// ── 12a. Copilot: wrap send() to await session.idle ──
|
|
843
|
+
// Copilot's send() is fire-and-forget — it returns immediately after
|
|
844
|
+
// queuing the message. Without this wrapper, stage callbacks complete
|
|
845
|
+
// before the agent finishes processing, causing getMessages() to
|
|
846
|
+
// return incomplete data and the stage to be marked done prematurely.
|
|
847
|
+
// We intercept send() to block until the session emits "session.idle",
|
|
848
|
+
// matching the blocking behavior of Claude's query() and OpenCode's
|
|
849
|
+
// session.prompt().
|
|
850
|
+
//
|
|
851
|
+
// Compatible with sendAndWait(): the SDK's _dispatchEvent broadcasts
|
|
852
|
+
// to all handlers (typed + wildcard), so both this wrapper's listener
|
|
853
|
+
// and sendAndWait's internal wildcard handler observe the same event.
|
|
854
|
+
if (shared.agent === "copilot") {
|
|
855
|
+
const copilotSession = providerSession as ProviderSession<"copilot">;
|
|
856
|
+
const nativeSend = copilotSession.send.bind(copilotSession);
|
|
857
|
+
copilotSession.send = async (options) => {
|
|
858
|
+
// Register listeners BEFORE sending to avoid a race where the
|
|
859
|
+
// agent finishes before the listener is attached. Listen for
|
|
860
|
+
// both idle (success) and error (failure) so we never hang if
|
|
861
|
+
// the session errors without reaching idle.
|
|
862
|
+
const idle = new Promise<void>((resolve, reject) => {
|
|
863
|
+
let unsubIdle: (() => void) | undefined;
|
|
864
|
+
let unsubError: (() => void) | undefined;
|
|
865
|
+
const cleanup = () => { unsubIdle?.(); unsubError?.(); };
|
|
866
|
+
unsubIdle = copilotSession.on("session.idle", () => {
|
|
867
|
+
cleanup();
|
|
868
|
+
resolve();
|
|
869
|
+
});
|
|
870
|
+
unsubError = copilotSession.on("session.error", (event) => {
|
|
871
|
+
cleanup();
|
|
872
|
+
const data = event.data as { message?: string } | undefined;
|
|
873
|
+
reject(new Error(data?.message ?? "Copilot session error"));
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
const messageId = await nativeSend(options);
|
|
877
|
+
await idle;
|
|
878
|
+
return messageId;
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
|
|
842
882
|
// ── 13. Construct SessionContext ──
|
|
843
883
|
// Free-form workflows read their prompt via `s.inputs.prompt`;
|
|
844
884
|
// structured workflows read their declared fields the same way.
|