@koda-sl/baker-bridge 0.192.0-dev.119a96955 → 0.192.0-dev.50a518bbd
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 +22 -16
- package/dist/broker/baker-api.d.ts +7 -0
- package/dist/broker/baker-api.d.ts.map +1 -1
- package/dist/broker/baker-api.js +6 -1
- package/dist/broker/baker-api.js.map +1 -1
- package/dist/broker/credential-text.d.ts +2 -0
- package/dist/broker/credential-text.d.ts.map +1 -1
- package/dist/broker/credential-text.js.map +1 -1
- package/dist/broker/proxy.d.ts.map +1 -1
- package/dist/broker/proxy.integration.test.js +57 -2
- package/dist/broker/proxy.integration.test.js.map +1 -1
- package/dist/broker/proxy.js +97 -6
- package/dist/broker/proxy.js.map +1 -1
- package/dist/broker/usage-reporter.d.ts +9 -5
- package/dist/broker/usage-reporter.d.ts.map +1 -1
- package/dist/broker/usage-reporter.js +25 -4
- package/dist/broker/usage-reporter.js.map +1 -1
- package/dist/broker/usage-reporter.test.js +82 -3
- package/dist/broker/usage-reporter.test.js.map +1 -1
- package/dist/hono/agent.d.ts.map +1 -1
- package/dist/hono/agent.js +4 -1
- package/dist/hono/agent.js.map +1 -1
- package/dist/hono/bridge-job.d.ts +17 -0
- package/dist/hono/bridge-job.d.ts.map +1 -1
- package/dist/hono/bridge-job.js +53 -35
- package/dist/hono/bridge-job.js.map +1 -1
- package/dist/hono/bridge-job.test.js +132 -96
- package/dist/hono/bridge-job.test.js.map +1 -1
- package/dist/hono/connection-input.d.ts.map +1 -1
- package/dist/hono/connection-input.js +6 -5
- package/dist/hono/connection-input.js.map +1 -1
- package/dist/hono/progress-note.d.ts +6 -0
- package/dist/hono/progress-note.d.ts.map +1 -0
- package/dist/hono/progress-note.js +25 -0
- package/dist/hono/progress-note.js.map +1 -0
- package/dist/hono/publish-handoff.d.ts +0 -5
- package/dist/hono/publish-handoff.d.ts.map +1 -1
- package/dist/hono/publish-handoff.js +6 -18
- package/dist/hono/publish-handoff.js.map +1 -1
- package/dist/hono/scripted-publish.d.ts +19 -0
- package/dist/hono/scripted-publish.d.ts.map +1 -0
- package/dist/hono/scripted-publish.js +219 -0
- package/dist/hono/scripted-publish.js.map +1 -0
- package/dist/hono/scripted-publish.test.d.ts +2 -0
- package/dist/hono/scripted-publish.test.d.ts.map +1 -0
- package/dist/hono/scripted-publish.test.js +212 -0
- package/dist/hono/scripted-publish.test.js.map +1 -0
- package/dist/hono/skill-language.d.ts +4 -3
- package/dist/hono/skill-language.d.ts.map +1 -1
- package/dist/hono/skill-language.js +14 -5
- package/dist/hono/skill-language.js.map +1 -1
- package/dist/hono/types.d.ts +7 -0
- package/dist/hono/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-input.d.ts","sourceRoot":"","sources":["../../src/hono/connection-input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection-input.d.ts","sourceRoot":"","sources":["../../src/hono/connection-input.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,YAC/B,YAAY,EACZ,UAAU,EACV,MAAM,EACN,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,CACD,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAmFvE,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAuE,CAAC;AAEpG,eAAO,MAAM,wBAAwB;IACnC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKX,UAAU;CAKX,CAAC;AAIF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAkCtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8D,CAAC;AAC3G,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,yBAAyB,GAAG,OAAO,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,yBAAyB,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAOhH;AAED,wFAAwF;AACxF,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,GAAG,IAAI,CAG/F;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AA6B5E;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,EAAE,CAoB1F;AAgBD,wBAAgB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAYxC"}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* `request_tag_input` and `request_flow_input`). It lets the chat agent ask the
|
|
4
4
|
* user to connect — or reconnect — anything the Integrations page connects: an
|
|
5
5
|
* ad or data platform (Google Ads, LinkedIn Ads, Meta Ads, X Ads, GA4, Search
|
|
6
|
-
* Console, Tag Manager), where they also pick which accounts it may read
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the
|
|
6
|
+
* Console, Tag Manager), where they also pick which accounts it may read;
|
|
7
|
+
* ChatGPT Ads or ActiveCampaign, whose key goes into the card; a tool (HubSpot,
|
|
8
|
+
* Google Drive, GoHighLevel, Pipedrive, Calendly, SavvyCal); or a Shopify store
|
|
9
|
+
* (the card asks for the store's address), where connecting is the whole
|
|
10
|
+
* answer — without the user leaving the chat.
|
|
10
11
|
* It also adds tools: a remote MCP server the user described (`{ server }`,
|
|
11
12
|
* filled in from their instructions) or, when the vendor has none, a managed
|
|
12
13
|
* app from the catalog (`{ app }`). Those load into the running query once the
|
|
@@ -261,7 +262,7 @@ export function normalizeConnectionInputToolInput(input) {
|
|
|
261
262
|
}
|
|
262
263
|
const CONNECTION_INPUT_TOOL_DESCRIPTION = [
|
|
263
264
|
"Ask the user to connect — or reconnect — something inside the chat. BLOCKS until they resolve it in the dashboard. Three kinds of entry, mixed freely in one call:",
|
|
264
|
-
"(1) `{ platform }` — one of Baker's connections: an ad or data platform (Google Ads, LinkedIn Ads, Meta Ads, X Ads, Google Analytics 4, Google Search Console, Google Tag Manager), where they also pick which accounts Baker may read; ChatGPT Ads (`chatgpt-ads`), where they paste its API key into the card; ActiveCampaign (`activecampaign`), where they paste its API URL and API key into the card; or a tool (HubSpot, Google Drive, GoHighLevel, Pipedrive, Calendly, SavvyCal). For these, Baker's own connection is the one to ask for, even when the vendor publishes an MCP server or the user names one — never as (2) or (3).",
|
|
265
|
+
"(1) `{ platform }` — one of Baker's connections: an ad or data platform (Google Ads, LinkedIn Ads, Meta Ads, X Ads, Google Analytics 4, Google Search Console, Google Tag Manager), where they also pick which accounts Baker may read; ChatGPT Ads (`chatgpt-ads`), where they paste its API key into the card; ActiveCampaign (`activecampaign`), where they paste its API URL and API key into the card; or a tool (HubSpot, Google Drive, GoHighLevel, Pipedrive, Calendly, SavvyCal, Shopify). For these, Baker's own connection is the one to ask for, even when the vendor publishes an MCP server or the user names one — never as (2) or (3).",
|
|
265
266
|
"(2) `{ server: { name, url, auth, keyHeader, scope } }` — a remote MCP server, for any other tool that is not connected, or when the user gives you an MCP server's address or setup instructions. The vendor's own server comes before (3). With no address given, find the vendor's official remote https endpoint and how it signs in before asking the user anything (`__tooling__/docs/tools/baker/mcp.md`). Official = on the vendor's own domain or in the vendor's own docs; never a server someone else hosts (a GitHub project, a directory listing) unless the user named it — with no official one, use (3). Fill in everything you know from their instructions — the card opens with it filled in and the user only confirms, types a key if there is one, or signs in. Never ask for a key in the chat.",
|
|
266
267
|
"(3) `{ app }` — the fallback when the vendor has no MCP server: a managed app from `baker mcp catalog --search <name>`, which the user signs in to from the card.",
|
|
267
268
|
"On a scheduled (unattended) run it returns at once with `leftInChat: true`: the card stays in the chat for the person to reconnect from later — use it there too for a lost platform, instead of only writing that they should reconnect.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-input.js","sourceRoot":"","sources":["../../src/hono/connection-input.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"connection-input.js","sourceRoot":"","sources":["../../src/hono/connection-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,MAAM,0BAA0B,GAAG,mCAAmC,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,YAAY;IACZ,UAAU;IACV,MAAM;IACN,kBAAkB;IAClB,uBAAuB;IACvB,oBAAoB;IACpB,OAAO;IACP,SAAS;IACT,cAAc;IACd,WAAW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AC;AAClB,CAAC;AAED,MAAM,iCAAiC,GAAG;IACxC,oKAAoK;IACpK,wnBAAwnB;IACxnB,wxBAAwxB;IACxxB,mKAAmK;IACnK,2OAA2O;IAC3O,mZAAmZ;IACnZ,+MAA+M;IAC/M,iTAAiT;IACjT,2aAA2a;IAC3a,shBAAshB;IACthB,8YAA8Y;CAC/Y,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,UAAU,yBAAyB;IACvC,OAAO,iBAAiB,CACtB,IAAI,CACF,oBAAoB,EACpB,iCAAiC,EACjC,wBAAwB,EACxB,CAAC,IAAI,EAA+D,EAAE;QACpE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAK,EAAE,OAAO,EAAE,EAAE,EAAuC,CAAC;QAC5F,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC,CACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Whether a non-empty `thinking` block from this model is a note for the user. */
|
|
2
|
+
export declare function writesProgressNotes(model: unknown): boolean;
|
|
3
|
+
export declare function progressNoteText(block: {
|
|
4
|
+
thinking?: unknown;
|
|
5
|
+
}, model: unknown): string | null;
|
|
6
|
+
//# sourceMappingURL=progress-note.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-note.d.ts","sourceRoot":"","sources":["../../src/hono/progress-note.ts"],"names":[],"mappings":"AAgBA,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAI7F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opus 5.5 and Sonnet 5.5 return a note longer than a sentence or two, written
|
|
3
|
+
* between tool calls for the user, as a `thinking` block rather than a `text`
|
|
4
|
+
* block. The CLI asks for those notes (`thinking.display: "updates"`) and
|
|
5
|
+
* leaves reasoning empty, so on these models a non-empty `thinking` block is a
|
|
6
|
+
* line the user reads. The bridge never asks for reasoning summaries, so a
|
|
7
|
+
* non-empty `thinking_delta` on the live stream is such a note too.
|
|
8
|
+
*
|
|
9
|
+
* The backend renders the same blocks in the transcript (`chat/utils.ts`
|
|
10
|
+
* `progressNoteText`).
|
|
11
|
+
*/
|
|
12
|
+
const PROGRESS_NOTE_MODEL = /(opus|sonnet)-5[.-]5/;
|
|
13
|
+
/** What the API writes in place of a note the response was cut off before finishing. */
|
|
14
|
+
const INTERRUPTED_PROGRESS_NOTE = "This part of the response was interrupted before it finished.";
|
|
15
|
+
/** Whether a non-empty `thinking` block from this model is a note for the user. */
|
|
16
|
+
export function writesProgressNotes(model) {
|
|
17
|
+
return typeof model === "string" && PROGRESS_NOTE_MODEL.test(model);
|
|
18
|
+
}
|
|
19
|
+
export function progressNoteText(block, model) {
|
|
20
|
+
if (!writesProgressNotes(model))
|
|
21
|
+
return null;
|
|
22
|
+
const text = typeof block.thinking === "string" ? block.thinking.trim() : "";
|
|
23
|
+
return text && text !== INTERRUPTED_PROGRESS_NOTE ? text : null;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=progress-note.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-note.js","sourceRoot":"","sources":["../../src/hono/progress-note.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AAEnD,wFAAwF;AACxF,MAAM,yBAAyB,GAAG,+DAA+D,CAAC;AAElG,mFAAmF;AACnF,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAA6B,EAAE,KAAc;IAC5E,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7E,OAAO,IAAI,IAAI,IAAI,KAAK,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC"}
|
|
@@ -18,11 +18,6 @@ export declare function lastTypedMessages(history: DispatchHistorySnapshot | und
|
|
|
18
18
|
* question still owed, then answered it in the closing line (BAKER-3389).
|
|
19
19
|
*/
|
|
20
20
|
export declare function publishLanguageReminder(history: DispatchHistorySnapshot | undefined): string | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* The language `publishLanguageReminder` names, or undefined when it can name
|
|
23
|
-
* none — then the company profile is the publish run's only other source for it.
|
|
24
|
-
*/
|
|
25
|
-
export declare function publishRunLanguage(history: DispatchHistorySnapshot | undefined): string | undefined;
|
|
26
21
|
/**
|
|
27
22
|
* What Publish told the user, when the last thing the user sent before this turn
|
|
28
23
|
* was `/publish`. The chat resumes a session that never saw the run, so without
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-handoff.d.ts","sourceRoot":"","sources":["../../src/hono/publish-handoff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA8B3E;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,uBAAuB,GAAG,SAAS,EAC5C,OAAO,CAAC,EAAE,MAAM,GACf;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAmBrC;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"publish-handoff.d.ts","sourceRoot":"","sources":["../../src/hono/publish-handoff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA8B3E;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,uBAAuB,GAAG,SAAS,EAC5C,OAAO,CAAC,EAAE,MAAM,GACf;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAmBrC;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAuBxG;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,uBAAuB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAoBnG;AAiDD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE;IAC3C,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,qBAAqB,CAAC,EAAE,eAAe,CAAC;CACzC,GAAG,MAAM,GAAG,SAAS,CAwCrB"}
|
|
@@ -64,8 +64,13 @@ export function publishLanguageReminder(history) {
|
|
|
64
64
|
const typed = lastTypedMessages(history);
|
|
65
65
|
if (typed.length === 0)
|
|
66
66
|
return undefined;
|
|
67
|
-
|
|
67
|
+
// A scheduled run's English brief that ends "Report in Spanish": its opening says English (BAKER-3249).
|
|
68
|
+
const requested = typed
|
|
69
|
+
.map((message) => requestedLanguage(message.whole))
|
|
70
|
+
.filter(Boolean)
|
|
71
|
+
.pop();
|
|
68
72
|
const whole = typed.map((message) => message.whole).join("\n");
|
|
73
|
+
const language = requested ?? identifiedLanguage(whole);
|
|
69
74
|
const likely = language ? [] : likelyLanguages(whole);
|
|
70
75
|
return [
|
|
71
76
|
"<system-reminder>",
|
|
@@ -80,23 +85,6 @@ export function publishLanguageReminder(history) {
|
|
|
80
85
|
"</system-reminder>",
|
|
81
86
|
].join("\n");
|
|
82
87
|
}
|
|
83
|
-
/**
|
|
84
|
-
* The language `publishLanguageReminder` names, or undefined when it can name
|
|
85
|
-
* none — then the company profile is the publish run's only other source for it.
|
|
86
|
-
*/
|
|
87
|
-
export function publishRunLanguage(history) {
|
|
88
|
-
const typed = lastTypedMessages(history);
|
|
89
|
-
return typed.length === 0 ? undefined : languageOf(typed).language;
|
|
90
|
-
}
|
|
91
|
-
function languageOf(typed) {
|
|
92
|
-
// A scheduled run's English brief that ends "Report in Spanish": its opening says English (BAKER-3249).
|
|
93
|
-
const requested = typed
|
|
94
|
-
.map((message) => requestedLanguage(message.whole))
|
|
95
|
-
.filter(Boolean)
|
|
96
|
-
.pop();
|
|
97
|
-
const language = requested ?? identifiedLanguage(typed.map((message) => message.whole).join("\n"));
|
|
98
|
-
return { ...(language ? { language } : {}), ...(requested ? { requested } : {}) };
|
|
99
|
-
}
|
|
100
88
|
/**
|
|
101
89
|
* What Publish told the user, when the last thing the user sent before this turn
|
|
102
90
|
* was `/publish`. The chat resumes a session that never saw the run, so without
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-handoff.js","sourceRoot":"","sources":["../../src/hono/publish-handoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,gFAAgF;AAChF,uEAAuE;AACvE,qEAAqE;AACrE,4EAA4E;AAC5E,4EAA4E;AAC5E,+EAA+E;AAC/E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publish ended: published, nothing to publish, or a failure the recovery reported. */
|
|
3
|
+
{
|
|
4
|
+
kind: "finished";
|
|
5
|
+
}
|
|
6
|
+
/** A step stopped before Baker was owed anything: the agent publishes, from step 1. */
|
|
7
|
+
| {
|
|
8
|
+
kind: "handOff";
|
|
9
|
+
step: string;
|
|
10
|
+
};
|
|
11
|
+
export type ScriptedPublishOptions = {
|
|
12
|
+
cwd: string;
|
|
13
|
+
/** The steps' whole environment, with the BAKER_THREAD_ID / BAKER_TURN_ID step 1 scopes the publish to. */
|
|
14
|
+
env: Record<string, string | undefined>;
|
|
15
|
+
/** The turn's: stopping it stops the step running, and no further step starts. */
|
|
16
|
+
signal: AbortSignal;
|
|
17
|
+
};
|
|
18
|
+
export declare function runScriptedPublish(options: ScriptedPublishOptions): Promise<ScriptedPublishResult>;
|
|
19
|
+
//# sourceMappingURL=scripted-publish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripted-publish.d.ts","sourceRoot":"","sources":["../../src/hono/scripted-publish.ts"],"names":[],"mappings":"AA8DA,MAAM,MAAM,qBAAqB;AAC/B,+GAA+G;AAC7G;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE;AACtB,uFAAuF;GACrF;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAItC,MAAM,MAAM,sBAAsB,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,2GAA2G;IAC3G,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,kFAAkF;IAClF,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AA8IF,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAsBxG"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { execFile, spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, unlinkSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { killFirstWrapper } from "./oom-priority.js";
|
|
5
|
+
import { recoverStalledPublish } from "./publish-recovery.js";
|
|
6
|
+
/**
|
|
7
|
+
* The publish Auto publish asked for, run as the publish skill's own scripts
|
|
8
|
+
* with no agent in between.
|
|
9
|
+
*
|
|
10
|
+
* A Scheduled agent's run the user gave Auto publish ends in a `/publish` that
|
|
11
|
+
* nobody watches. Run by the agent, it started a session of its own: every
|
|
12
|
+
* SessionStart probe again, a cold model turn, and a line to the marketer that
|
|
13
|
+
* said nothing the Publish notice does not (BAKER-231). On the path where every
|
|
14
|
+
* step passes, the skill asks the agent for no judgement, so here the steps run
|
|
15
|
+
* in order, exactly as the skill lists them.
|
|
16
|
+
*
|
|
17
|
+
* The first step that stops hands the publish to the agent, which runs the
|
|
18
|
+
* whole skill from step 1 as it always has — after the workspace is put back so
|
|
19
|
+
* that step 1 can start again (`releaseForAgent`). A failure Baker never heard
|
|
20
|
+
* about is delivered by the recovery first, then handed over too. Only a publish
|
|
21
|
+
* whose push may have landed, or whose turn was stopped, is not handed over: the
|
|
22
|
+
* recovery delivers its last word, and the Publish notice tells the marketer how
|
|
23
|
+
* it ended.
|
|
24
|
+
*/
|
|
25
|
+
const SKILL_SCRIPTS = ".claude/skills/publish/scripts";
|
|
26
|
+
const PUBLISH_STATE_FILE = ".cache/publish-state.json";
|
|
27
|
+
/** The scaffold's reader of that file: what a state on disk means is its to say. */
|
|
28
|
+
const PUBLISH_STATE_MODULE = "__tooling__/checks/sdk/publish-state.mjs";
|
|
29
|
+
const NOTHING_TO_PUBLISH = "NOTHING_TO_PUBLISH";
|
|
30
|
+
const MIN = 60_000;
|
|
31
|
+
/** How long a stopped step's processes get to exit on SIGTERM before SIGKILL. */
|
|
32
|
+
const STOP_GRACE_MS = 5_000;
|
|
33
|
+
/** The skill's steps 2 to 5, after step 1 named the branch. */
|
|
34
|
+
const AFTER_PREPARE = [
|
|
35
|
+
{ name: "rebase", command: "git", args: () => ["rebase", "main"], timeoutMs: 5 * MIN },
|
|
36
|
+
{
|
|
37
|
+
name: "build-and-amend",
|
|
38
|
+
command: "node",
|
|
39
|
+
args: (branch) => [`${SKILL_SCRIPTS}/build-and-amend.mjs`, branch],
|
|
40
|
+
timeoutMs: 15 * MIN,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "verify",
|
|
44
|
+
command: "node",
|
|
45
|
+
args: () => [`${SKILL_SCRIPTS}/run-verify.mjs`, "--no-cache"],
|
|
46
|
+
timeoutMs: 30 * MIN,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "finalize",
|
|
50
|
+
command: "node",
|
|
51
|
+
args: (branch) => [`${SKILL_SCRIPTS}/finalize-publish.mjs`, branch],
|
|
52
|
+
timeoutMs: 15 * MIN,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
const REQUIRED_SCRIPTS = ["prepare-publish.mjs", "build-and-amend.mjs", "run-verify.mjs", "finalize-publish.mjs"];
|
|
56
|
+
/** Signals every process of the step's group; false once none is left. */
|
|
57
|
+
function signalGroup(pid, signal) {
|
|
58
|
+
try {
|
|
59
|
+
process.kill(-pid, signal);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Stops a step and everything it started. A step's real work runs in its own
|
|
68
|
+
* children — `pnpm verify`, shadowdog, `git push` — which a signal to the step
|
|
69
|
+
* alone leaves running, still writing while the recovery or the agent's publish
|
|
70
|
+
* goes on. So the step leads a process group of its own, and the whole group
|
|
71
|
+
* goes; resolves once none of it is left.
|
|
72
|
+
*/
|
|
73
|
+
async function stopGroup(pid) {
|
|
74
|
+
if (!signalGroup(pid, "SIGTERM"))
|
|
75
|
+
return;
|
|
76
|
+
const killAt = Date.now() + STOP_GRACE_MS;
|
|
77
|
+
const giveUpAt = killAt + STOP_GRACE_MS;
|
|
78
|
+
while (signalGroup(pid, 0) && Date.now() < giveUpAt) {
|
|
79
|
+
if (Date.now() >= killAt)
|
|
80
|
+
signalGroup(pid, "SIGKILL");
|
|
81
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const MAX_OUTPUT = 20 * 1024 * 1024;
|
|
85
|
+
function runStep(step, args, options) {
|
|
86
|
+
// A publish's build and verify are the biggest things a Runtime runs: the
|
|
87
|
+
// kernel's OOM killer takes them before the bridge, as it does the agent's commands.
|
|
88
|
+
const wrapper = killFirstWrapper();
|
|
89
|
+
const [file, argv] = wrapper ? [wrapper, [step.command, ...args]] : [step.command, args];
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
if (options.signal.aborted) {
|
|
92
|
+
resolve({ ok: false, stdout: "", stderr: "" });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const child = spawn(file, argv, {
|
|
96
|
+
cwd: options.cwd,
|
|
97
|
+
env: options.env,
|
|
98
|
+
detached: true,
|
|
99
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
100
|
+
});
|
|
101
|
+
let stdout = "";
|
|
102
|
+
let stderr = "";
|
|
103
|
+
child.stdout.on("data", (chunk) => {
|
|
104
|
+
if (stdout.length < MAX_OUTPUT)
|
|
105
|
+
stdout += chunk.toString();
|
|
106
|
+
});
|
|
107
|
+
child.stderr.on("data", (chunk) => {
|
|
108
|
+
if (stderr.length < MAX_OUTPUT)
|
|
109
|
+
stderr += chunk.toString();
|
|
110
|
+
});
|
|
111
|
+
let settled = false;
|
|
112
|
+
let stopping = null;
|
|
113
|
+
const settle = (ok) => {
|
|
114
|
+
if (settled)
|
|
115
|
+
return;
|
|
116
|
+
settled = true;
|
|
117
|
+
clearTimeout(timer);
|
|
118
|
+
options.signal.removeEventListener("abort", stop);
|
|
119
|
+
// A stopped step is over only once its whole group is gone.
|
|
120
|
+
void Promise.resolve(stopping).then(() => resolve({ ok: ok && stopping === null, stdout, stderr }));
|
|
121
|
+
};
|
|
122
|
+
// Timed out or the turn stopped: the group goes, and the step failed even
|
|
123
|
+
// when something outside the group still holds its output open.
|
|
124
|
+
function stop() {
|
|
125
|
+
if (stopping !== null || child.pid === undefined)
|
|
126
|
+
return;
|
|
127
|
+
stopping = stopGroup(child.pid);
|
|
128
|
+
void stopping.then(() => settle(false));
|
|
129
|
+
}
|
|
130
|
+
const timer = setTimeout(stop, step.timeoutMs);
|
|
131
|
+
options.signal.addEventListener("abort", stop, { once: true });
|
|
132
|
+
child.on("error", () => settle(false));
|
|
133
|
+
child.on("close", (code) => settle(code === 0));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* What the publish state on disk means, as the scaffold reads it: null when
|
|
138
|
+
* there is none, `publishing` while nothing is owed to Baker yet, `push_failed`
|
|
139
|
+
* for a failure Baker may not have heard, and `owed` for anything else — a push
|
|
140
|
+
* that may have landed, a completion an older scaffold recorded with no phase,
|
|
141
|
+
* or a state this workspace cannot read.
|
|
142
|
+
*/
|
|
143
|
+
async function publishStanding(options) {
|
|
144
|
+
if (!existsSync(join(options.cwd, PUBLISH_STATE_FILE)))
|
|
145
|
+
return null;
|
|
146
|
+
if (!existsSync(join(options.cwd, PUBLISH_STATE_MODULE)))
|
|
147
|
+
return "owed";
|
|
148
|
+
const read = [
|
|
149
|
+
`const { readPublishState } = await import(${JSON.stringify(`./${PUBLISH_STATE_MODULE}`)});`,
|
|
150
|
+
"const state = readPublishState();",
|
|
151
|
+
'process.stdout.write(state?.terminalStatus === "completed" ? "completed" : String(state?.phase));',
|
|
152
|
+
].join("\n");
|
|
153
|
+
const phase = await new Promise((resolve) => {
|
|
154
|
+
execFile("node", ["--input-type=module", "-e", read], { cwd: options.cwd, env: options.env, timeout: MIN }, (error, stdout) => resolve(error === null ? String(stdout).trim() : "unreadable"));
|
|
155
|
+
});
|
|
156
|
+
return phase === "publishing" || phase === "push_failed" ? phase : "owed";
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Puts the workspace back where step 1 can start again, or says it cannot.
|
|
160
|
+
*
|
|
161
|
+
* A step that stopped mid-rebase leaves the rebase open; step 1 refuses to start
|
|
162
|
+
* over one. And while Baker shows the chat publishing with nothing yet owed to
|
|
163
|
+
* it (`publishing`), step 1 refuses to start over the state file that records it;
|
|
164
|
+
* started again, step 1 writes it anew and tells Baker `publishing` once more,
|
|
165
|
+
* which changes nothing there. A failure Baker may not have heard (`push_failed`:
|
|
166
|
+
* nothing was pushed) is delivered by the recovery first, and released once it
|
|
167
|
+
* has been. Any other phase is a word still owed to Baker — a push that may have
|
|
168
|
+
* landed — and only the recovery delivers it correctly.
|
|
169
|
+
*/
|
|
170
|
+
async function releaseForAgent(options) {
|
|
171
|
+
const gitDir = join(options.cwd, ".git");
|
|
172
|
+
if (existsSync(join(gitDir, "rebase-merge")) || existsSync(join(gitDir, "rebase-apply"))) {
|
|
173
|
+
await runStep({ command: "git", timeoutMs: MIN }, ["rebase", "--abort"], options);
|
|
174
|
+
}
|
|
175
|
+
const standing = await publishStanding(options);
|
|
176
|
+
if (standing === null)
|
|
177
|
+
return true;
|
|
178
|
+
if (standing === "publishing") {
|
|
179
|
+
unlinkSync(join(options.cwd, PUBLISH_STATE_FILE));
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
if (standing === "push_failed") {
|
|
183
|
+
await recoverStalledPublish(options.cwd);
|
|
184
|
+
return !existsSync(join(options.cwd, PUBLISH_STATE_FILE));
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
async function stopped(step, options) {
|
|
189
|
+
// A stopped turn hands nothing on: the recovery tells Baker the publish failed, as it does for an agent's.
|
|
190
|
+
if (!options.signal.aborted && (await releaseForAgent(options)))
|
|
191
|
+
return { kind: "handOff", step };
|
|
192
|
+
await recoverStalledPublish(options.cwd);
|
|
193
|
+
return { kind: "finished" };
|
|
194
|
+
}
|
|
195
|
+
export async function runScriptedPublish(options) {
|
|
196
|
+
// A workspace whose scaffold predates these scripts publishes the way it always has.
|
|
197
|
+
if (!REQUIRED_SCRIPTS.every((script) => existsSync(join(options.cwd, SKILL_SCRIPTS, script)))) {
|
|
198
|
+
return { kind: "handOff", step: "prepare" };
|
|
199
|
+
}
|
|
200
|
+
const prepare = await runStep({ command: "node", timeoutMs: 10 * MIN }, [`${SKILL_SCRIPTS}/prepare-publish.mjs`], options);
|
|
201
|
+
// Printed only once Baker took it: the chat is completed, there was nothing to merge.
|
|
202
|
+
if (!prepare.ok && prepare.stderr.includes(NOTHING_TO_PUBLISH))
|
|
203
|
+
return { kind: "finished" };
|
|
204
|
+
const branch = prepare.stdout.trim();
|
|
205
|
+
if (!prepare.ok || !branch)
|
|
206
|
+
return await stopped("prepare", options);
|
|
207
|
+
for (const step of AFTER_PREPARE) {
|
|
208
|
+
if (options.signal.aborted)
|
|
209
|
+
return await stopped(step.name, options);
|
|
210
|
+
const result = await runStep(step, step.args(branch), options);
|
|
211
|
+
if (!result.ok)
|
|
212
|
+
return await stopped(step.name, options);
|
|
213
|
+
}
|
|
214
|
+
// Pushed, but Baker never heard: the recovery tells it, as it does after an agent's publish.
|
|
215
|
+
if (existsSync(join(options.cwd, PUBLISH_STATE_FILE)))
|
|
216
|
+
await recoverStalledPublish(options.cwd);
|
|
217
|
+
return { kind: "finished" };
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=scripted-publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripted-publish.js","sourceRoot":"","sources":["../../src/hono/scripted-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mB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