@caelo-cms/mcp-server 0.10.42 → 0.10.43
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/approval-wait.d.ts +10 -0
- package/dist/approval-wait.d.ts.map +1 -1
- package/dist/approval-wait.js +21 -9
- package/dist/approval-wait.js.map +1 -1
- package/dist/chat-approval.d.ts +94 -0
- package/dist/chat-approval.d.ts.map +1 -0
- package/dist/chat-approval.js +96 -0
- package/dist/chat-approval.js.map +1 -0
- package/dist/chat-bridge.d.ts +16 -13
- package/dist/chat-bridge.d.ts.map +1 -1
- package/dist/chat-bridge.js +23 -0
- package/dist/chat-bridge.js.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +158 -20
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/approval-wait.d.ts
CHANGED
|
@@ -41,6 +41,16 @@ export interface WaitDeps {
|
|
|
41
41
|
/** Called after every still-pending poll (keeps progress-aware clients alive). */
|
|
42
42
|
readonly onPending?: (elapsedMs: number) => Promise<void> | void;
|
|
43
43
|
}
|
|
44
|
+
/** Generic bounded poll: re-fetch every `intervalMs` until `done` or `waitMs` elapsed. */
|
|
45
|
+
export declare function pollUntil<T>(deps: {
|
|
46
|
+
readonly fetch: () => Promise<T>;
|
|
47
|
+
readonly done: (value: T) => boolean;
|
|
48
|
+
readonly waitMs: number;
|
|
49
|
+
readonly intervalMs?: number;
|
|
50
|
+
readonly sleep?: (ms: number) => Promise<void>;
|
|
51
|
+
readonly now?: () => number;
|
|
52
|
+
readonly onPending?: (elapsedMs: number) => Promise<void> | void;
|
|
53
|
+
}): Promise<T>;
|
|
44
54
|
/**
|
|
45
55
|
* Polls until the proposal is decided or `waitMs` elapsed; returns the
|
|
46
56
|
* last outcome read (still `pending` on timeout).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-wait.d.ts","sourceRoot":"","sources":["../src/approval-wait.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MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAClE,GAAG,OAAO,CAAC,CAAC,CAAC,CAYb;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,CAU9E;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CAqBlE"}
|
package/dist/approval-wait.js
CHANGED
|
@@ -17,22 +17,34 @@ export function resolveApprovalWaitMs() {
|
|
|
17
17
|
}
|
|
18
18
|
return parsed;
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
* last outcome read (still `pending` on timeout).
|
|
23
|
-
*/
|
|
24
|
-
export async function waitForApproval(deps) {
|
|
20
|
+
/** Generic bounded poll: re-fetch every `intervalMs` until `done` or `waitMs` elapsed. */
|
|
21
|
+
export async function pollUntil(deps) {
|
|
25
22
|
const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
26
23
|
const now = deps.now ?? Date.now;
|
|
27
24
|
const interval = deps.intervalMs ?? APPROVAL_POLL_INTERVAL_MS;
|
|
28
25
|
const start = now();
|
|
29
|
-
let
|
|
30
|
-
while (
|
|
26
|
+
let value = await deps.fetch();
|
|
27
|
+
while (!deps.done(value) && now() - start < deps.waitMs) {
|
|
31
28
|
await deps.onPending?.(now() - start);
|
|
32
29
|
await sleep(Math.min(interval, Math.max(0, deps.waitMs - (now() - start))));
|
|
33
|
-
|
|
30
|
+
value = await deps.fetch();
|
|
34
31
|
}
|
|
35
|
-
return
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Polls until the proposal is decided or `waitMs` elapsed; returns the
|
|
36
|
+
* last outcome read (still `pending` on timeout).
|
|
37
|
+
*/
|
|
38
|
+
export async function waitForApproval(deps) {
|
|
39
|
+
return pollUntil({
|
|
40
|
+
fetch: deps.fetchOutcome,
|
|
41
|
+
done: (o) => o.outcome !== "pending",
|
|
42
|
+
waitMs: deps.waitMs,
|
|
43
|
+
...(deps.intervalMs !== undefined ? { intervalMs: deps.intervalMs } : {}),
|
|
44
|
+
...(deps.sleep ? { sleep: deps.sleep } : {}),
|
|
45
|
+
...(deps.now ? { now: deps.now } : {}),
|
|
46
|
+
...(deps.onPending ? { onPending: deps.onPending } : {}),
|
|
47
|
+
});
|
|
36
48
|
}
|
|
37
49
|
/** The text the agent reads for an outcome — always names its next step. */
|
|
38
50
|
export function describeApprovalOutcome(o) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-wait.js","sourceRoot":"","sources":["../src/approval-wait.ts"],"names":[],"mappings":"AAAA,mCAAmC;AA6BnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE/C,gFAAgF;AAChF,MAAM,UAAU,qBAAqB;IACnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;IACnD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,wBAAwB,CAAC;IACrE,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CA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|
4
|
+
readonly toolName: string;
|
|
5
|
+
readonly preview: string;
|
|
6
|
+
}
|
|
7
|
+
/** What `/api/mcp/chat` returns. */
|
|
8
|
+
export interface SendChatResult {
|
|
9
|
+
readonly chatSessionId: string;
|
|
10
|
+
readonly requestId: string;
|
|
11
|
+
readonly assistant: string;
|
|
12
|
+
readonly toolCalls: ReadonlyArray<{
|
|
13
|
+
name: string;
|
|
14
|
+
summary: string;
|
|
15
|
+
succeeded: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
readonly pendingProposals: number;
|
|
18
|
+
readonly costMicrocents: number;
|
|
19
|
+
readonly pendingApprovals: readonly PendingChatApproval[];
|
|
20
|
+
}
|
|
21
|
+
/** One card as `/api/mcp/chat/approval` reports it. */
|
|
22
|
+
export interface ChatApprovalView {
|
|
23
|
+
readonly approvalId: string;
|
|
24
|
+
readonly toolName: string;
|
|
25
|
+
readonly preview: string;
|
|
26
|
+
readonly status: "pending" | "approved" | "rejected" | "resumed" | "superseded";
|
|
27
|
+
readonly approved: boolean | null;
|
|
28
|
+
readonly reason: string | null;
|
|
29
|
+
}
|
|
30
|
+
/** What `/api/mcp/chat/approval` returns. */
|
|
31
|
+
export interface ChatApprovalState {
|
|
32
|
+
readonly state: "pending" | "decided" | "superseded" | "none";
|
|
33
|
+
readonly approvals: readonly ChatApprovalView[];
|
|
34
|
+
}
|
|
35
|
+
export interface SettleDeps {
|
|
36
|
+
readonly chatSessionId: string;
|
|
37
|
+
readonly fetchState: () => Promise<ChatApprovalState>;
|
|
38
|
+
/** Resume the agent's paused turn with the operator's decisions. */
|
|
39
|
+
readonly resume: () => Promise<SendChatResult>;
|
|
40
|
+
/** The whole call's budget: waiting AND the resumed turn must fit in it. */
|
|
41
|
+
readonly waitMs: number;
|
|
42
|
+
/**
|
|
43
|
+
* Time kept back for the resumed turn (its HTTP timeout). A decision seen
|
|
44
|
+
* later than `waitMs - resumeReserveMs` is not resumed in this call — the
|
|
45
|
+
* result says to continue with caelo_await_approval — so the call never
|
|
46
|
+
* outlives the MCP client's request timeout while approved work runs on
|
|
47
|
+
* without a reader (codex review).
|
|
48
|
+
*/
|
|
49
|
+
readonly resumeReserveMs: number;
|
|
50
|
+
readonly intervalMs?: number;
|
|
51
|
+
readonly sleep?: (ms: number) => Promise<void>;
|
|
52
|
+
readonly now?: () => number;
|
|
53
|
+
readonly onPending?: (elapsedMs: number) => Promise<void> | void;
|
|
54
|
+
}
|
|
55
|
+
/** Where the paused turn stands after waiting. */
|
|
56
|
+
export type SettleResult = {
|
|
57
|
+
/** Every pause was decided and resumed; `turns` are the resumed replies. */
|
|
58
|
+
readonly kind: "settled";
|
|
59
|
+
readonly decided: readonly ChatApprovalView[];
|
|
60
|
+
readonly turns: readonly SendChatResult[];
|
|
61
|
+
} | {
|
|
62
|
+
/** The bound ran out with cards undecided. */
|
|
63
|
+
readonly kind: "pending";
|
|
64
|
+
readonly decided: readonly ChatApprovalView[];
|
|
65
|
+
readonly turns: readonly SendChatResult[];
|
|
66
|
+
readonly waiting: readonly ChatApprovalView[];
|
|
67
|
+
} | {
|
|
68
|
+
/** Every card is decided, but too little budget is left to resume now. */
|
|
69
|
+
readonly kind: "ready";
|
|
70
|
+
readonly decided: readonly ChatApprovalView[];
|
|
71
|
+
readonly turns: readonly SendChatResult[];
|
|
72
|
+
} | {
|
|
73
|
+
/** A newer message moved the chat past the paused turn. */
|
|
74
|
+
readonly kind: "superseded";
|
|
75
|
+
readonly decided: readonly ChatApprovalView[];
|
|
76
|
+
readonly turns: readonly SendChatResult[];
|
|
77
|
+
readonly dropped: readonly ChatApprovalView[];
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Wait for the operator's decisions and resume the paused turn once, within
|
|
81
|
+
* the call's budget. If the resumed turn pauses again, the call returns that
|
|
82
|
+
* pause right away (codex review: another read could outlive the client's
|
|
83
|
+
* timeout); `caelo_await_approval` picks it up.
|
|
84
|
+
*/
|
|
85
|
+
export declare function settleChatApprovals(deps: SettleDeps): Promise<SettleResult>;
|
|
86
|
+
/** One line per decided card, for the agent. */
|
|
87
|
+
export declare function describeDecisions(decided: readonly ChatApprovalView[]): string;
|
|
88
|
+
/** The note for cards the agent is still waiting on — always names the next step. */
|
|
89
|
+
export declare function describeWaiting(chatSessionId: string, waiting: readonly Pick<ChatApprovalView, "toolName">[]): string;
|
|
90
|
+
/** The note when the operator decided but this call has no time left to continue. */
|
|
91
|
+
export declare function describeReady(chatSessionId: string): string;
|
|
92
|
+
/** The note for cards a newer message in the chat dropped. */
|
|
93
|
+
export declare function describeSuperseded(dropped: readonly ChatApprovalView[]): string;
|
|
94
|
+
//# sourceMappingURL=chat-approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-approval.d.ts","sourceRoot":"","sources":["../src/chat-approval.ts"],"names":[],"mappings":"AAwBA,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACzF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAC3D;AAED,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAC/B,QAA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a,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,CAM/E"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Issue #658 — caelo_chat: an approval-gated tool pauses the Caelo chat
|
|
4
|
+
* turn on approval cards the operator decides in the Caelo admin (the Live
|
|
5
|
+
* Edit chat shows them as the external agent's request). This is the
|
|
6
|
+
* agent's side of that pause:
|
|
7
|
+
*
|
|
8
|
+
* 1. the caelo_chat reply lists the cards (`pendingApprovals`);
|
|
9
|
+
* 2. the MCP server waits (bounded, `CAELO_MCP_APPROVAL_WAIT_MS`) until the
|
|
10
|
+
* operator decided every card (`/api/mcp/chat/approval`);
|
|
11
|
+
* 3. it resumes the agent's OWN paused turn (`/api/mcp/chat` with
|
|
12
|
+
* `resumeApprovals: true`) — the operator's click never starts a Live
|
|
13
|
+
* Edit AI turn — and returns that turn's reply, which carries the
|
|
14
|
+
* outcome (applied, or the model's reaction to a rejection);
|
|
15
|
+
* 4. past the bound it returns the cards plus the `caelo_await_approval`
|
|
16
|
+
* hint, which picks the wait up again.
|
|
17
|
+
*
|
|
18
|
+
* The agent never decides (CLAUDE.md §11.A): every endpoint here only reads
|
|
19
|
+
* the decision or continues after it.
|
|
20
|
+
*/
|
|
21
|
+
import { pollUntil } from "./approval-wait.js";
|
|
22
|
+
/**
|
|
23
|
+
* Wait for the operator's decisions and resume the paused turn once, within
|
|
24
|
+
* the call's budget. If the resumed turn pauses again, the call returns that
|
|
25
|
+
* pause right away (codex review: another read could outlive the client's
|
|
26
|
+
* timeout); `caelo_await_approval` picks it up.
|
|
27
|
+
*/
|
|
28
|
+
export async function settleChatApprovals(deps) {
|
|
29
|
+
const now = deps.now ?? Date.now;
|
|
30
|
+
const deadline = now() + deps.waitMs;
|
|
31
|
+
// Decisions are waited for only while a resume still fits after them.
|
|
32
|
+
const pollDeadline = deadline - deps.resumeReserveMs;
|
|
33
|
+
const state = await pollUntil({
|
|
34
|
+
fetch: deps.fetchState,
|
|
35
|
+
done: (s) => s.state !== "pending",
|
|
36
|
+
waitMs: Math.max(0, pollDeadline - now()),
|
|
37
|
+
...(deps.intervalMs !== undefined ? { intervalMs: deps.intervalMs } : {}),
|
|
38
|
+
...(deps.sleep ? { sleep: deps.sleep } : {}),
|
|
39
|
+
now,
|
|
40
|
+
...(deps.onPending ? { onPending: deps.onPending } : {}),
|
|
41
|
+
});
|
|
42
|
+
if (state.state === "pending") {
|
|
43
|
+
return { kind: "pending", decided: [], turns: [], waiting: state.approvals };
|
|
44
|
+
}
|
|
45
|
+
if (state.state === "superseded") {
|
|
46
|
+
return { kind: "superseded", decided: [], turns: [], dropped: state.approvals };
|
|
47
|
+
}
|
|
48
|
+
if (state.state === "none")
|
|
49
|
+
return { kind: "settled", decided: [], turns: [] };
|
|
50
|
+
// Reads take time too: start the resume only while its whole timeout still
|
|
51
|
+
// fits in the call's budget.
|
|
52
|
+
if (deadline - now() < deps.resumeReserveMs)
|
|
53
|
+
return { kind: "ready", decided: [], turns: [] };
|
|
54
|
+
const decided = [...state.approvals];
|
|
55
|
+
const resumed = await deps.resume();
|
|
56
|
+
if (resumed.pendingApprovals.length === 0) {
|
|
57
|
+
return { kind: "settled", decided, turns: [resumed] };
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
kind: "pending",
|
|
61
|
+
decided,
|
|
62
|
+
turns: [resumed],
|
|
63
|
+
waiting: resumed.pendingApprovals.map((a) => ({
|
|
64
|
+
...a,
|
|
65
|
+
status: "pending",
|
|
66
|
+
approved: null,
|
|
67
|
+
reason: null,
|
|
68
|
+
})),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** One line per decided card, for the agent. */
|
|
72
|
+
export function describeDecisions(decided) {
|
|
73
|
+
return decided
|
|
74
|
+
.map((a) => a.approved
|
|
75
|
+
? `The operator APPROVED ${a.toolName}; your turn continued with it.`
|
|
76
|
+
: `The operator REJECTED ${a.toolName}${a.reason ? ` (reason: ${a.reason})` : ""}; it was not applied.`)
|
|
77
|
+
.join("\n");
|
|
78
|
+
}
|
|
79
|
+
/** The note for cards the agent is still waiting on — always names the next step. */
|
|
80
|
+
export function describeWaiting(chatSessionId, waiting) {
|
|
81
|
+
return (`Waiting for the operator to approve or reject ${waiting.map((a) => a.toolName).join(", ")} in the Caelo admin. ` +
|
|
82
|
+
`Nothing of it is applied yet. Call caelo_await_approval with chatSessionId "${chatSessionId}" to keep waiting ` +
|
|
83
|
+
"(your turn continues with the decision), or tell your user. Do not send the request again.");
|
|
84
|
+
}
|
|
85
|
+
/** The note when the operator decided but this call has no time left to continue. */
|
|
86
|
+
export function describeReady(chatSessionId) {
|
|
87
|
+
return ("The operator has decided. Call caelo_await_approval with chatSessionId " +
|
|
88
|
+
`"${chatSessionId}" now to continue your turn with the decision; nothing of it is applied until then.`);
|
|
89
|
+
}
|
|
90
|
+
/** The note for cards a newer message in the chat dropped. */
|
|
91
|
+
export function describeSuperseded(dropped) {
|
|
92
|
+
const names = dropped.map((a) => a.toolName).join(", ") || "the gated action";
|
|
93
|
+
return (`A newer message in the chat moved on before your turn resumed, so ${names} was not applied. ` +
|
|
94
|
+
"Send it again with caelo_chat if it is still needed.");
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=chat-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-approval.js","sourceRoot":"","sources":["../src/chat-approval.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAsF/C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAgB;IACxD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG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AAC,CAAC,EAAE,uBAAuB,CAC1G;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAC7B,aAAqB,EACrB,OAAsD;IAEtD,OAAO,CACL,iDAAiD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB;QACjH,+EAA+E,aAAa,oBAAoB;QAChH,4FAA4F,CAC7F,CAAC;AACJ,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,aAAa,CAAC,aAAqB;IACjD,OAAO,CACL,yEAAyE;QACzE,IAAI,aAAa,qFAAqF,CACvG,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,OAAoC;IACrE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC;IAC9E,OAAO,CACL,qEAAqE,KAAK,oBAAoB;QAC9F,sDAAsD,CACvD,CAAC;AACJ,CAAC"}
|
package/dist/chat-bridge.d.ts
CHANGED
|
@@ -10,26 +10,29 @@
|
|
|
10
10
|
* clients see a clean error instead of a hung connection.
|
|
11
11
|
*/
|
|
12
12
|
import type { z } from "zod";
|
|
13
|
+
import type { ChatApprovalState, SendChatResult } from "./chat-approval.js";
|
|
13
14
|
import type { uploadedImageSchema } from "./image-upload.js";
|
|
14
|
-
|
|
15
|
+
interface AdminTarget {
|
|
15
16
|
readonly adminUrl: string;
|
|
16
17
|
readonly token: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SendChatOpts extends AdminTarget {
|
|
17
20
|
readonly message: string;
|
|
18
21
|
readonly attachments?: z.infer<typeof uploadedImageSchema>[];
|
|
19
22
|
readonly chatSessionId?: string;
|
|
20
23
|
readonly pageId?: string;
|
|
21
24
|
}
|
|
22
|
-
export interface SendChatResult {
|
|
23
|
-
readonly chatSessionId: string;
|
|
24
|
-
readonly requestId: string;
|
|
25
|
-
readonly assistant: string;
|
|
26
|
-
readonly toolCalls: ReadonlyArray<{
|
|
27
|
-
name: string;
|
|
28
|
-
summary: string;
|
|
29
|
-
succeeded: boolean;
|
|
30
|
-
}>;
|
|
31
|
-
readonly pendingProposals: number;
|
|
32
|
-
readonly costMicrocents: number;
|
|
33
|
-
}
|
|
34
25
|
export declare function sendChat(opts: SendChatOpts): Promise<SendChatResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Issue #658 — resume this token's paused turn once the operator decided
|
|
28
|
+
* every approval card of it. The reply is the resumed turn's.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resumeChat(opts: AdminTarget & {
|
|
31
|
+
readonly chatSessionId: string;
|
|
32
|
+
}): Promise<SendChatResult>;
|
|
33
|
+
/** Issue #658 — the operator's decisions on this token's paused turn (read-only). */
|
|
34
|
+
export declare function fetchChatApprovalState(opts: AdminTarget & {
|
|
35
|
+
readonly chatSessionId: string;
|
|
36
|
+
}): Promise<ChatApprovalState>;
|
|
37
|
+
export {};
|
|
35
38
|
//# sourceMappingURL=chat-bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-bridge.d.ts","sourceRoot":"","sources":["../src/chat-bridge.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-bridge.d.ts","sourceRoot":"","sources":["../src/chat-bridge.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,UAAU,WAAW;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,EAAE,CAAC;IAC7D,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAa1E;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACrD,OAAO,CAAC,cAAc,CAAC,CAQzB;AAED,qFAAqF;AACrF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACrD,OAAO,CAAC,iBAAiB,CAAC,CAQ5B"}
|
package/dist/chat-bridge.js
CHANGED
|
@@ -14,4 +14,27 @@ export async function sendChat(opts) {
|
|
|
14
14
|
timeoutMs: resolveTimeoutMs(30_000),
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Issue #658 — resume this token's paused turn once the operator decided
|
|
19
|
+
* every approval card of it. The reply is the resumed turn's.
|
|
20
|
+
*/
|
|
21
|
+
export async function resumeChat(opts) {
|
|
22
|
+
return postAdmin({
|
|
23
|
+
adminUrl: opts.adminUrl,
|
|
24
|
+
token: opts.token,
|
|
25
|
+
path: "/api/mcp/chat",
|
|
26
|
+
body: { chatSessionId: opts.chatSessionId, resumeApprovals: true },
|
|
27
|
+
timeoutMs: resolveTimeoutMs(30_000),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Issue #658 — the operator's decisions on this token's paused turn (read-only). */
|
|
31
|
+
export async function fetchChatApprovalState(opts) {
|
|
32
|
+
return postAdmin({
|
|
33
|
+
adminUrl: opts.adminUrl,
|
|
34
|
+
token: opts.token,
|
|
35
|
+
path: "/api/mcp/chat/approval",
|
|
36
|
+
body: { chatSessionId: opts.chatSessionId },
|
|
37
|
+
timeoutMs: resolveTimeoutMs(30_000),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
17
40
|
//# sourceMappingURL=chat-bridge.js.map
|
package/dist/chat-bridge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-bridge.js","sourceRoot":"","sources":["../src/chat-bridge.ts"],"names":[],"mappings":"AAAA,mCAAmC;
|
|
1
|
+
{"version":3,"file":"chat-bridge.js","sourceRoot":"","sources":["../src/chat-bridge.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAgBnC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAexD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAkB;IAC/C,OAAO,SAAS,CAAiB;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE;YACJ,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB;QACD,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC;KACpC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,IAAsD;IAEtD,OAAO,SAAS,CAAiB;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,eAAe,EAAE,IAAI,EAAE;QAClE,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC;KACpC,CAAC,CAAC;AACL,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAsD;IAEtD,OAAO,SAAS,CAAoB;QAClC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE;QAC3C,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC;KACpC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface StartOpts {
|
|
|
4
4
|
readonly token: string;
|
|
5
5
|
/** Defaults to stdio; tests pass an in-memory transport. */
|
|
6
6
|
readonly transport?: Transport;
|
|
7
|
+
/** Poll interval while waiting on an approval; tests shorten it. */
|
|
8
|
+
readonly approvalPollMs?: number;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* MCP `instructions` for the chat-scope server (#552), injected into the
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAiB/E,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,oEAAoE;IACpE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAKtB,CAAC;AAsFb,wBAAsB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAgMnE"}
|
package/dist/server.js
CHANGED
|
@@ -12,7 +12,10 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
12
12
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
13
|
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
|
-
import {
|
|
15
|
+
import { resolveApprovalWaitMs } from "./approval-wait.js";
|
|
16
|
+
import { describeDecisions, describeReady, describeSuperseded, describeWaiting, settleChatApprovals, } from "./chat-approval.js";
|
|
17
|
+
import { fetchChatApprovalState, resumeChat, sendChat } from "./chat-bridge.js";
|
|
18
|
+
import { resolveTimeoutMs } from "./http.js";
|
|
16
19
|
import { UPLOAD_IMAGES_TOOL, uploadedImageSchema, uploadImages } from "./image-upload.js";
|
|
17
20
|
/**
|
|
18
21
|
* MCP `instructions` for the chat-scope server (#552), injected into the
|
|
@@ -23,7 +26,72 @@ export const CHAT_MCP_INSTRUCTIONS = [
|
|
|
23
26
|
"This server talks to a Caelo CMS site's own AI agent through caelo_chat; describe the outcome you want and the agent decides how to build it.",
|
|
24
27
|
"Pass the chatSessionId from a reply to continue the same conversation; omit it only to start a new one.",
|
|
25
28
|
"Changes land on that chat's preview branch; nothing reaches the live site until the operator publishes in the Caelo admin. Some actions wait for the operator's approval click there.",
|
|
29
|
+
"When a reply says the turn is waiting for the operator's approval, call caelo_await_approval with the chatSessionId: it waits for the decision and returns your turn's continuation. Never re-send the request; you cannot approve anything yourself.",
|
|
26
30
|
].join("\n");
|
|
31
|
+
const awaitApprovalInput = z.object({ chatSessionId: z.string().uuid() }).strict();
|
|
32
|
+
/** The resume request's timeout (`resumeChat`), reserved out of a call's budget. */
|
|
33
|
+
const resumeTimeoutMs = () => resolveTimeoutMs(30_000);
|
|
34
|
+
/** Headroom for the state reads around a resume in caelo_await_approval. */
|
|
35
|
+
const RESUME_SLACK_MS = 5_000;
|
|
36
|
+
/** Issue #658 — keep waiting on the approval cards a caelo_chat turn paused on. */
|
|
37
|
+
const AWAIT_APPROVAL_TOOL = {
|
|
38
|
+
name: "caelo_await_approval",
|
|
39
|
+
description: "Wait for the operator's Approve/Reject on the approval cards your caelo_chat turn paused on, then " +
|
|
40
|
+
"continue that turn and return its reply (the change applied, or the agent's reaction to a rejection). " +
|
|
41
|
+
"Use it when a caelo_chat reply says it is still waiting for approval. You cannot approve anything " +
|
|
42
|
+
"yourself — only the operator can, in the Caelo admin.",
|
|
43
|
+
inputSchema: {
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
chatSessionId: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "The chatSessionId from the caelo_chat reply that is waiting.",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
required: ["chatSessionId"],
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The tool result for a caelo_chat exchange: every reply in order (the first
|
|
56
|
+
* turn, then each resumed one), the decisions in between, and — while cards
|
|
57
|
+
* still wait — the next step.
|
|
58
|
+
*/
|
|
59
|
+
function chatResult(first, settled, chatSessionId) {
|
|
60
|
+
const turns = first ? [first, ...settled.turns] : [...settled.turns];
|
|
61
|
+
const last = turns.at(-1);
|
|
62
|
+
const text = [
|
|
63
|
+
...(first ? [first.assistant] : []),
|
|
64
|
+
...(settled.decided.length > 0 ? [describeDecisions(settled.decided)] : []),
|
|
65
|
+
...settled.turns.map((t) => t.assistant),
|
|
66
|
+
...(settled.kind === "pending" ? [describeWaiting(chatSessionId, settled.waiting)] : []),
|
|
67
|
+
...(settled.kind === "superseded" ? [describeSuperseded(settled.dropped)] : []),
|
|
68
|
+
...(settled.kind === "ready" ? [describeReady(chatSessionId)] : []),
|
|
69
|
+
]
|
|
70
|
+
.filter((t) => t.trim().length > 0)
|
|
71
|
+
.join("\n\n");
|
|
72
|
+
const reply = text.length > 0
|
|
73
|
+
? text
|
|
74
|
+
: "Nothing of yours waits for the operator's approval in this chat; continue with caelo_chat.";
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{ type: "text", text: reply },
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: JSON.stringify({
|
|
81
|
+
chatSessionId,
|
|
82
|
+
requestId: last?.requestId ?? null,
|
|
83
|
+
toolCalls: turns.flatMap((t) => t.toolCalls),
|
|
84
|
+
pendingProposals: last?.pendingProposals ?? 0,
|
|
85
|
+
costMicrocents: turns.reduce((sum, t) => sum + t.costMicrocents, 0),
|
|
86
|
+
// Non-empty while the turn waits on the operator.
|
|
87
|
+
pendingApprovals: settled.kind === "pending"
|
|
88
|
+
? settled.waiting.map((a) => ({ approvalId: a.approvalId, toolName: a.toolName }))
|
|
89
|
+
: [],
|
|
90
|
+
}, null, 2),
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
27
95
|
const caeloChatInputSchema = z
|
|
28
96
|
.object({
|
|
29
97
|
attachments: z.array(uploadedImageSchema).max(4).optional(),
|
|
@@ -43,6 +111,7 @@ export async function startMcpServer(opts) {
|
|
|
43
111
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
44
112
|
tools: [
|
|
45
113
|
UPLOAD_IMAGES_TOOL,
|
|
114
|
+
AWAIT_APPROVAL_TOOL,
|
|
46
115
|
{
|
|
47
116
|
name: "caelo_chat",
|
|
48
117
|
description: "Talk to your Caelo CMS install's AI agent. Same agent that powers the live-edit chat overlay — it can read pages, propose edits, queue Owner-approval proposals, summarise plugin data. Continues an existing chat session (when chatSessionId is supplied) or starts a fresh one. Returns the agent's reply text plus structured tool-call summaries.",
|
|
@@ -73,7 +142,33 @@ export async function startMcpServer(opts) {
|
|
|
73
142
|
},
|
|
74
143
|
],
|
|
75
144
|
}));
|
|
76
|
-
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
145
|
+
server.setRequestHandler(CallToolRequestSchema, async (req, extra) => {
|
|
146
|
+
// Progress notifications keep progress-aware clients from timing the
|
|
147
|
+
// call out while it waits on the operator (only when they asked).
|
|
148
|
+
const progressToken = req.params._meta?.progressToken;
|
|
149
|
+
const onPending = progressToken === undefined
|
|
150
|
+
? undefined
|
|
151
|
+
: async (elapsedMs) => {
|
|
152
|
+
await extra.sendNotification({
|
|
153
|
+
method: "notifications/progress",
|
|
154
|
+
params: {
|
|
155
|
+
progressToken,
|
|
156
|
+
progress: Math.round(elapsedMs / 1000),
|
|
157
|
+
message: "Waiting for the operator to approve or reject in the Caelo admin…",
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
/** Wait for the operator, then continue the paused turn (issue #658). */
|
|
162
|
+
const settle = (chatSessionId, waitMs) => settleChatApprovals({
|
|
163
|
+
chatSessionId,
|
|
164
|
+
fetchState: () => fetchChatApprovalState({ ...opts, chatSessionId }),
|
|
165
|
+
resume: () => resumeChat({ ...opts, chatSessionId }),
|
|
166
|
+
waitMs,
|
|
167
|
+
// The resume POST's whole timeout stays inside the call's budget.
|
|
168
|
+
resumeReserveMs: resumeTimeoutMs(),
|
|
169
|
+
...(opts.approvalPollMs !== undefined ? { intervalMs: opts.approvalPollMs } : {}),
|
|
170
|
+
...(onPending ? { onPending } : {}),
|
|
171
|
+
});
|
|
77
172
|
if (req.params.name === UPLOAD_IMAGES_TOOL.name) {
|
|
78
173
|
try {
|
|
79
174
|
return await uploadImages(opts, req.params.arguments);
|
|
@@ -82,6 +177,28 @@ export async function startMcpServer(opts) {
|
|
|
82
177
|
return { isError: true, content: [{ type: "text", text: String(e) }] };
|
|
83
178
|
}
|
|
84
179
|
}
|
|
180
|
+
if (req.params.name === AWAIT_APPROVAL_TOOL.name) {
|
|
181
|
+
const parsed = awaitApprovalInput.safeParse(req.params.arguments ?? {});
|
|
182
|
+
if (!parsed.success) {
|
|
183
|
+
return {
|
|
184
|
+
isError: true,
|
|
185
|
+
content: [{ type: "text", text: `invalid arguments: ${parsed.error.message}` }],
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
// Room for at least one resume, even with a short configured wait —
|
|
190
|
+
// otherwise a decided turn could never continue.
|
|
191
|
+
const settled = await settle(parsed.data.chatSessionId, Math.max(resolveApprovalWaitMs(), resumeTimeoutMs() + RESUME_SLACK_MS));
|
|
192
|
+
return chatResult(null, settled, parsed.data.chatSessionId);
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
196
|
+
return {
|
|
197
|
+
isError: true,
|
|
198
|
+
content: [{ type: "text", text: `caelo_await_approval failed: ${msg}` }],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
85
202
|
if (req.params.name !== "caelo_chat") {
|
|
86
203
|
return {
|
|
87
204
|
isError: true,
|
|
@@ -96,6 +213,7 @@ export async function startMcpServer(opts) {
|
|
|
96
213
|
};
|
|
97
214
|
}
|
|
98
215
|
try {
|
|
216
|
+
const startedAt = Date.now();
|
|
99
217
|
const result = await sendChat({
|
|
100
218
|
adminUrl: opts.adminUrl,
|
|
101
219
|
token: opts.token,
|
|
@@ -104,24 +222,44 @@ export async function startMcpServer(opts) {
|
|
|
104
222
|
...(parsed.data.chatSessionId ? { chatSessionId: parsed.data.chatSessionId } : {}),
|
|
105
223
|
...(parsed.data.pageId ? { pageId: parsed.data.pageId } : {}),
|
|
106
224
|
});
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
225
|
+
// Issue #658 — the turn paused on approval cards: wait for the
|
|
226
|
+
// operator's decision within what is left of the wait bound, then
|
|
227
|
+
// continue this same turn and return its reply too.
|
|
228
|
+
if (result.pendingApprovals.length === 0) {
|
|
229
|
+
return chatResult(result, { kind: "settled", decided: [], turns: [] }, result.chatSessionId);
|
|
230
|
+
}
|
|
231
|
+
let settled;
|
|
232
|
+
try {
|
|
233
|
+
settled = await settle(result.chatSessionId, Math.max(0, resolveApprovalWaitMs() - (Date.now() - startedAt)));
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
// The turn ran and its session exists: keep both in the result so
|
|
237
|
+
// the agent can continue with caelo_await_approval instead of
|
|
238
|
+
// retrying into duplicate work (codex review).
|
|
239
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
240
|
+
const waiting = chatResult(result, {
|
|
241
|
+
kind: "pending",
|
|
242
|
+
decided: [],
|
|
243
|
+
turns: [],
|
|
244
|
+
waiting: result.pendingApprovals.map((a) => ({
|
|
245
|
+
...a,
|
|
246
|
+
status: "pending",
|
|
247
|
+
approved: null,
|
|
248
|
+
reason: null,
|
|
249
|
+
})),
|
|
250
|
+
}, result.chatSessionId);
|
|
251
|
+
return {
|
|
252
|
+
...waiting,
|
|
253
|
+
content: [
|
|
254
|
+
...waiting.content,
|
|
255
|
+
{
|
|
256
|
+
type: "text",
|
|
257
|
+
text: `Checking the operator's decision failed (${msg}); the request still exists. Call caelo_await_approval with chatSessionId "${result.chatSessionId}".`,
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
return chatResult(result, settled, result.chatSessionId);
|
|
125
263
|
}
|
|
126
264
|
catch (e) {
|
|
127
265
|
const msg = e instanceof Error ? e.message : String(e);
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,eAAe,EAGf,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAW1F;;;;GAIG;AACH,MAAM,CAAC,M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,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,GAAG,EAAE,EAAE,CAAC;aAC/D,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACrE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caelo-cms/mcp-server",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.43",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"description": "MCP servers for Caelo CMS: `caelo_chat` (talk to Caelo's own AI) and the admin-scoped Power-MCP (the full chat-runner tool catalogue, driven by your own agent). Lets Claude Code (or any MCP-aware client) drive a Caelo install from outside the browser.",
|