@moxxy/sdk 0.44.0 → 0.45.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.
- package/dist/agent-account-limit.d.ts +41 -0
- package/dist/agent-account-limit.d.ts.map +1 -0
- package/dist/agent-account-limit.js +64 -0
- package/dist/agent-account-limit.js.map +1 -0
- package/dist/agent-computer-use.d.ts +10 -0
- package/dist/agent-computer-use.d.ts.map +1 -0
- package/dist/agent-computer-use.js +24 -0
- package/dist/agent-computer-use.js.map +1 -0
- package/dist/agent-context-window.d.ts +22 -0
- package/dist/agent-context-window.d.ts.map +1 -0
- package/dist/agent-context-window.js +40 -0
- package/dist/agent-context-window.js.map +1 -0
- package/dist/agent-no-reply.d.ts +11 -0
- package/dist/agent-no-reply.d.ts.map +1 -0
- package/dist/agent-no-reply.js +13 -0
- package/dist/agent-no-reply.js.map +1 -0
- package/dist/agent-step.d.ts +14 -0
- package/dist/agent-step.d.ts.map +1 -0
- package/dist/agent-step.js +26 -0
- package/dist/agent-step.js.map +1 -0
- package/dist/agent-work.d.ts +34 -0
- package/dist/agent-work.d.ts.map +1 -0
- package/dist/agent-work.js +80 -0
- package/dist/agent-work.js.map +1 -0
- package/dist/attachment-payload.d.ts +1 -1
- package/dist/attachment-payload.js +1 -1
- package/dist/auto-approve.d.ts +9 -0
- package/dist/auto-approve.d.ts.map +1 -1
- package/dist/auto-approve.js +18 -0
- package/dist/auto-approve.js.map +1 -1
- package/dist/channel-auth.d.ts +3 -3
- package/dist/channel-auth.d.ts.map +1 -1
- package/dist/channel-auth.js +1 -1
- package/dist/channel.d.ts +1 -1
- package/dist/client-session.d.ts +9 -5
- package/dist/client-session.d.ts.map +1 -1
- package/dist/computer-control.d.ts +11 -11
- package/dist/computer-control.d.ts.map +1 -1
- package/dist/computer-control.js +1 -1
- package/dist/computer-control.js.map +1 -1
- package/dist/conversation-history.d.ts +50 -0
- package/dist/conversation-history.d.ts.map +1 -0
- package/dist/conversation-history.js +227 -0
- package/dist/conversation-history.js.map +1 -0
- package/dist/cron.d.ts +58 -0
- package/dist/cron.d.ts.map +1 -0
- package/dist/cron.js +320 -0
- package/dist/cron.js.map +1 -0
- package/dist/define.d.ts +2 -1
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +1 -0
- package/dist/define.js.map +1 -1
- package/dist/event-store.d.ts +1 -1
- package/dist/event-store.d.ts.map +1 -1
- package/dist/event-store.js +1 -0
- package/dist/event-store.js.map +1 -1
- package/dist/events.d.ts +17 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/file-diff.d.ts +31 -0
- package/dist/file-diff.d.ts.map +1 -0
- package/dist/file-diff.js +196 -0
- package/dist/file-diff.js.map +1 -0
- package/dist/index.d.ts +22 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/mode/agent-step-loop.d.ts +13 -0
- package/dist/mode/agent-step-loop.d.ts.map +1 -0
- package/dist/mode/agent-step-loop.js +578 -0
- package/dist/mode/agent-step-loop.js.map +1 -0
- package/dist/mode/checkpoint-gate.d.ts +25 -0
- package/dist/mode/checkpoint-gate.d.ts.map +1 -0
- package/dist/mode/checkpoint-gate.js +150 -0
- package/dist/mode/checkpoint-gate.js.map +1 -0
- package/dist/mode/checkpoint.d.ts +6 -0
- package/dist/mode/checkpoint.d.ts.map +1 -1
- package/dist/mode/collect-stream.d.ts +2 -0
- package/dist/mode/collect-stream.d.ts.map +1 -1
- package/dist/mode/collect-stream.js +1 -1
- package/dist/mode/collect-stream.js.map +1 -1
- package/dist/mode/project-messages.d.ts.map +1 -1
- package/dist/mode/project-messages.js +9 -67
- package/dist/mode/project-messages.js.map +1 -1
- package/dist/mode/react-loop-options.d.ts +113 -0
- package/dist/mode/react-loop-options.d.ts.map +1 -0
- package/dist/mode/react-loop-options.js +2 -0
- package/dist/mode/react-loop-options.js.map +1 -0
- package/dist/mode/react-loop.d.ts +2 -99
- package/dist/mode/react-loop.d.ts.map +1 -1
- package/dist/mode/react-loop.js +7 -145
- package/dist/mode/react-loop.js.map +1 -1
- package/dist/mode.d.ts +19 -7
- package/dist/mode.d.ts.map +1 -1
- package/dist/mode.js +1 -1
- package/dist/mode.js.map +1 -1
- package/dist/npm-registry.d.ts +22 -0
- package/dist/npm-registry.d.ts.map +1 -0
- package/dist/npm-registry.js +54 -0
- package/dist/npm-registry.js.map +1 -0
- package/dist/permission.d.ts +31 -0
- package/dist/permission.d.ts.map +1 -1
- package/dist/process-invocation.d.ts +2 -0
- package/dist/process-invocation.d.ts.map +1 -1
- package/dist/process-invocation.js +2 -2
- package/dist/process-invocation.js.map +1 -1
- package/dist/process-tree.d.ts +9 -0
- package/dist/process-tree.d.ts.map +1 -0
- package/dist/process-tree.js +40 -0
- package/dist/process-tree.js.map +1 -0
- package/dist/provider-login-bridge.js +1 -1
- package/dist/provider-login-bridge.js.map +1 -1
- package/dist/provider.d.ts +408 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/question-draft.d.ts +19 -0
- package/dist/question-draft.d.ts.map +1 -0
- package/dist/question-draft.js +30 -0
- package/dist/question-draft.js.map +1 -0
- package/dist/question.d.ts +204 -0
- package/dist/question.d.ts.map +1 -0
- package/dist/question.js +141 -0
- package/dist/question.js.map +1 -0
- package/dist/questions.d.ts +7 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +7 -0
- package/dist/questions.js.map +1 -0
- package/dist/resolvers.d.ts +14 -1
- package/dist/resolvers.d.ts.map +1 -1
- package/dist/resolvers.js +33 -21
- package/dist/resolvers.js.map +1 -1
- package/dist/schemas.d.ts +53 -53
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +3 -2
- package/dist/schemas.js.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -0
- package/dist/server.js.map +1 -1
- package/dist/session-like.d.ts +19 -1
- package/dist/session-like.d.ts.map +1 -1
- package/dist/starting-model.d.ts +12 -0
- package/dist/starting-model.d.ts.map +1 -0
- package/dist/starting-model.js +9 -0
- package/dist/starting-model.js.map +1 -0
- package/dist/tool-dispatch.d.ts.map +1 -1
- package/dist/tool-dispatch.js +10 -4
- package/dist/tool-dispatch.js.map +1 -1
- package/dist/tool-display.d.ts +79 -3
- package/dist/tool-display.d.ts.map +1 -1
- package/dist/tool-display.js +117 -3
- package/dist/tool-display.js.map +1 -1
- package/dist/tool-modes.d.ts +1 -1
- package/dist/tool-modes.d.ts.map +1 -1
- package/dist/tool-modes.js +8 -2
- package/dist/tool-modes.js.map +1 -1
- package/dist/tool-output.d.ts +15 -0
- package/dist/tool-output.d.ts.map +1 -0
- package/dist/tool-output.js +39 -0
- package/dist/tool-output.js.map +1 -0
- package/dist/tool.d.ts +14 -1
- package/dist/tool.d.ts.map +1 -1
- package/dist/tunnel.d.ts +3 -3
- package/dist/tunnel.d.ts.map +1 -1
- package/dist/tunnel.js +2 -2
- package/dist/workflow-approval.d.ts +9 -9
- package/dist/workflow-approval.d.ts.map +1 -1
- package/dist/workflow-approval.js +1 -1
- package/dist/workflow-approval.js.map +1 -1
- package/package.json +33 -5
- package/src/agent-account-limit.test.ts +87 -0
- package/src/agent-account-limit.ts +89 -0
- package/src/agent-computer-use.test.ts +26 -0
- package/src/agent-computer-use.ts +29 -0
- package/src/agent-context-window.ts +51 -0
- package/src/agent-no-reply.ts +16 -0
- package/src/agent-step.ts +26 -0
- package/src/agent-work.ts +102 -0
- package/src/attachment-payload.ts +1 -1
- package/src/auto-approve.test.ts +13 -1
- package/src/auto-approve.ts +19 -0
- package/src/channel-auth.ts +3 -3
- package/src/channel.ts +1 -1
- package/src/client-session.ts +9 -2
- package/src/computer-control.ts +1 -1
- package/src/conversation-history.test.ts +184 -0
- package/src/conversation-history.ts +272 -0
- package/src/cron.test.ts +280 -0
- package/src/cron.ts +355 -0
- package/src/define.test.ts +1 -1
- package/src/define.ts +3 -1
- package/src/event-store.ts +2 -1
- package/src/events.ts +17 -1
- package/src/file-diff.test.ts +103 -0
- package/src/file-diff.ts +208 -0
- package/src/index.ts +121 -1
- package/src/json-file-store.test.ts +1 -1
- package/src/loop-helpers.test.ts +15 -0
- package/src/mode/agent-step-loop.ts +645 -0
- package/src/mode/checkpoint-gate.ts +198 -0
- package/src/mode/checkpoint.ts +6 -0
- package/src/mode/collect-stream.ts +1 -1
- package/src/mode/project-messages.test.ts +11 -0
- package/src/mode/project-messages.ts +8 -61
- package/src/mode/react-loop-options.ts +124 -0
- package/src/mode/react-loop.ts +10 -296
- package/src/mode.ts +19 -7
- package/src/npm-registry.test.ts +95 -0
- package/src/npm-registry.ts +57 -0
- package/src/permission.ts +30 -0
- package/src/process-invocation.test.ts +25 -0
- package/src/process-invocation.ts +8 -3
- package/src/process-tree.ts +37 -0
- package/src/provider-login-bridge.ts +1 -1
- package/src/provider-schema-constraints.test.ts +1 -1
- package/src/provider-utils.test.ts +1 -1
- package/src/provider.ts +346 -0
- package/src/question-draft.test.ts +57 -0
- package/src/question-draft.ts +47 -0
- package/src/question.test.ts +130 -0
- package/src/question.ts +229 -0
- package/src/questions.ts +6 -0
- package/src/resolvers.test.ts +84 -1
- package/src/resolvers.ts +40 -27
- package/src/schemas.test.ts +5 -0
- package/src/schemas.ts +3 -2
- package/src/server.ts +3 -0
- package/src/session-like.ts +19 -1
- package/src/skill-mentions.test.ts +1 -1
- package/src/starting-model.test.ts +19 -0
- package/src/starting-model.ts +11 -0
- package/src/token-efficiency.test.ts +1 -1
- package/src/tool-dispatch.ts +10 -4
- package/src/tool-display.test.ts +119 -0
- package/src/tool-display.ts +162 -4
- package/src/tool-gating.test.ts +1 -1
- package/src/tool-icon.test.ts +1 -1
- package/src/tool-modes.test.ts +18 -1
- package/src/tool-modes.ts +6 -2
- package/src/tool-output.test.ts +46 -0
- package/src/tool-output.ts +46 -0
- package/src/tool.ts +14 -1
- package/src/tunnel.ts +3 -3
- package/src/workflow-approval.ts +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { MoxxyEvent } from './events.js';
|
|
2
|
+
/**
|
|
3
|
+
* How much of the person's account an agent connection's agent may still use, as the agent
|
|
4
|
+
* reports it (Claude's plan limits, Codex's rate limits). Recorded in the log, so every surface
|
|
5
|
+
* reads the same state.
|
|
6
|
+
*/
|
|
7
|
+
export interface AgentAccountLimit {
|
|
8
|
+
/** `reached`: the agent does no work until `resetsAt`; `near`: most of the window is used. */
|
|
9
|
+
readonly state: 'ok' | 'near' | 'reached';
|
|
10
|
+
/** When the window resets, in epoch ms, when the agent says. */
|
|
11
|
+
readonly resetsAt?: number;
|
|
12
|
+
/** The window's length in minutes: 300 for five hours, 10080 for a week. */
|
|
13
|
+
readonly windowMinutes?: number;
|
|
14
|
+
/** How much of the window is used, 0–100. */
|
|
15
|
+
readonly usedPercent?: number;
|
|
16
|
+
}
|
|
17
|
+
/** From how much of a window a limit counts as near, for an agent that does not say so itself (Claude warns from 75%). */
|
|
18
|
+
export declare const ACCOUNT_LIMIT_NEAR_PERCENT = 75;
|
|
19
|
+
/** Where an agent connection records its agent's account limit, under `AGENT_CONNECTION_PLUGIN_ID`. */
|
|
20
|
+
export declare const AGENT_ACCOUNT_LIMIT_SUBTYPE = "account_limit";
|
|
21
|
+
export interface RecordedAccountLimit {
|
|
22
|
+
readonly provider: string;
|
|
23
|
+
/** The agent's name ("Claude", "Codex"), for the surfaces to say whose limit it is. */
|
|
24
|
+
readonly agent?: string;
|
|
25
|
+
readonly limit: AgentAccountLimit;
|
|
26
|
+
}
|
|
27
|
+
/** The last account limit recorded for the provider. */
|
|
28
|
+
export declare function recordedAccountLimit(events: ReadonlyArray<MoxxyEvent>, provider: string): RecordedAccountLimit | undefined;
|
|
29
|
+
/** The limit a plugin event records, or undefined when it records something else. */
|
|
30
|
+
export declare function accountLimitOfEvent(event: MoxxyEvent): RecordedAccountLimit | undefined;
|
|
31
|
+
/** A near or reached limit, until its window resets; a limit with room left says nothing. */
|
|
32
|
+
export declare function accountLimitInForce(recorded: RecordedAccountLimit | undefined, nowMs: number): RecordedAccountLimit | undefined;
|
|
33
|
+
/** Whether two reports would read the same to the person: whole percents, the reset to the minute. */
|
|
34
|
+
export declare function sameAccountLimit(a: AgentAccountLimit | undefined, b: AgentAccountLimit): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* A used-up limit the agent reports without its reset (Claude Code's own
|
|
37
|
+
* "You've hit your limit" when its process already said when it resets) keeps
|
|
38
|
+
* the reset known before, while that still lies ahead.
|
|
39
|
+
*/
|
|
40
|
+
export declare function withKnownReset(reading: AgentAccountLimit, known: AgentAccountLimit | undefined, nowMs: number): AgentAccountLimit;
|
|
41
|
+
//# sourceMappingURL=agent-account-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-account-limit.d.ts","sourceRoot":"","sources":["../src/agent-account-limit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IAC1C,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,0HAA0H;AAC1H,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,uGAAuG;AACvG,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;CACnC;AAED,wDAAwD;AACxD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAS1H;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,oBAAoB,GAAG,SAAS,CAIvF;AAUD,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAI/H;AAED,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,GAAG,SAAS,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAUhG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAIjI"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AGENT_CONNECTION_PLUGIN_ID } from './agent-step.js';
|
|
2
|
+
/** From how much of a window a limit counts as near, for an agent that does not say so itself (Claude warns from 75%). */
|
|
3
|
+
export const ACCOUNT_LIMIT_NEAR_PERCENT = 75;
|
|
4
|
+
/** Where an agent connection records its agent's account limit, under `AGENT_CONNECTION_PLUGIN_ID`. */
|
|
5
|
+
export const AGENT_ACCOUNT_LIMIT_SUBTYPE = 'account_limit';
|
|
6
|
+
/** The last account limit recorded for the provider. */
|
|
7
|
+
export function recordedAccountLimit(events, provider) {
|
|
8
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
9
|
+
const event = events[i];
|
|
10
|
+
if (!event || event.type !== 'plugin_event')
|
|
11
|
+
continue;
|
|
12
|
+
if (event.pluginId !== AGENT_CONNECTION_PLUGIN_ID || event.subtype !== AGENT_ACCOUNT_LIMIT_SUBTYPE)
|
|
13
|
+
continue;
|
|
14
|
+
const payload = event.payload;
|
|
15
|
+
if (payload && payload.provider === provider && payload.limit)
|
|
16
|
+
return accountLimitPayload(payload);
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
/** The limit a plugin event records, or undefined when it records something else. */
|
|
21
|
+
export function accountLimitOfEvent(event) {
|
|
22
|
+
if (event.type !== 'plugin_event' || event.pluginId !== AGENT_CONNECTION_PLUGIN_ID || event.subtype !== AGENT_ACCOUNT_LIMIT_SUBTYPE)
|
|
23
|
+
return undefined;
|
|
24
|
+
const payload = event.payload;
|
|
25
|
+
return payload && typeof payload.provider === 'string' && payload.limit ? accountLimitPayload(payload) : undefined;
|
|
26
|
+
}
|
|
27
|
+
function accountLimitPayload(payload) {
|
|
28
|
+
return {
|
|
29
|
+
provider: String(payload.provider),
|
|
30
|
+
...(typeof payload.agent === 'string' ? { agent: payload.agent } : {}),
|
|
31
|
+
limit: payload.limit,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** A near or reached limit, until its window resets; a limit with room left says nothing. */
|
|
35
|
+
export function accountLimitInForce(recorded, nowMs) {
|
|
36
|
+
if (!recorded || recorded.limit.state === 'ok')
|
|
37
|
+
return undefined;
|
|
38
|
+
const { resetsAt } = recorded.limit;
|
|
39
|
+
return resetsAt !== undefined && resetsAt <= nowMs ? undefined : recorded;
|
|
40
|
+
}
|
|
41
|
+
/** Whether two reports would read the same to the person: whole percents, the reset to the minute. */
|
|
42
|
+
export function sameAccountLimit(a, b) {
|
|
43
|
+
if (!a)
|
|
44
|
+
return false;
|
|
45
|
+
const minute = (ms) => (ms === undefined ? undefined : Math.round(ms / 60_000));
|
|
46
|
+
const percent = (p) => (p === undefined ? undefined : Math.floor(p));
|
|
47
|
+
return (a.state === b.state &&
|
|
48
|
+
a.windowMinutes === b.windowMinutes &&
|
|
49
|
+
minute(a.resetsAt) === minute(b.resetsAt) &&
|
|
50
|
+
percent(a.usedPercent) === percent(b.usedPercent));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A used-up limit the agent reports without its reset (Claude Code's own
|
|
54
|
+
* "You've hit your limit" when its process already said when it resets) keeps
|
|
55
|
+
* the reset known before, while that still lies ahead.
|
|
56
|
+
*/
|
|
57
|
+
export function withKnownReset(reading, known, nowMs) {
|
|
58
|
+
if (reading.state !== 'reached' || reading.resetsAt !== undefined)
|
|
59
|
+
return reading;
|
|
60
|
+
if (!known || known.resetsAt === undefined || known.resetsAt <= nowMs)
|
|
61
|
+
return reading;
|
|
62
|
+
return { ...reading, resetsAt: known.resetsAt, ...(known.windowMinutes !== undefined && reading.windowMinutes === undefined ? { windowMinutes: known.windowMinutes } : {}) };
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=agent-account-limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-account-limit.js","sourceRoot":"","sources":["../src/agent-account-limit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAmB7D,0HAA0H;AAC1H,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,uGAAuG;AACvG,MAAM,CAAC,MAAM,2BAA2B,GAAG,eAAe,CAAC;AAS3D,wDAAwD;AACxD,MAAM,UAAU,oBAAoB,CAAC,MAAiC,EAAE,QAAgB;IACtF,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;YAAE,SAAS;QACtD,IAAI,KAAK,CAAC,QAAQ,KAAK,0BAA0B,IAAI,KAAK,CAAC,OAAO,KAAK,2BAA2B;YAAE,SAAS;QAC7G,MAAM,OAAO,GAAG,KAAK,CAAC,OAA+C,CAAC;QAC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KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC/K,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a tool call an agent connection ran itself operates the person's computer, recognised
|
|
3
|
+
* by the tool's name, so every surface can say the agent is using the computer and offer Stop.
|
|
4
|
+
*/
|
|
5
|
+
export interface AgentComputerUse {
|
|
6
|
+
/** The app the call names, `null` when it names none (listing apps, a screenshot of the screen). */
|
|
7
|
+
readonly app: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function agentComputerUseOf(name: string, input: unknown): AgentComputerUse | undefined;
|
|
10
|
+
//# sourceMappingURL=agent-computer-use.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-computer-use.d.ts","sourceRoot":"","sources":["../src/agent-computer-use.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,oGAAoG;IACpG,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAYD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAQ7F"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a tool call an agent connection ran itself operates the person's computer, recognised
|
|
3
|
+
* by the tool's name, so every surface can say the agent is using the computer and offer Stop.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A computer-use MCP server's tools, which drive the person's apps: `mcp__computer-use__click` from
|
|
7
|
+
* Claude Code and Codex, `computer-use_click` from OpenCode (which names MCP tools `server_tool`).
|
|
8
|
+
*/
|
|
9
|
+
const COMPUTER_SERVERS = /^(?:mcp__)?computer[-_]use_/;
|
|
10
|
+
/** Codex's computer use as JavaScript against its `cua` API; the same API also drives Codex's own browser. */
|
|
11
|
+
const CUA_JS = 'mcp__cua_repl__js';
|
|
12
|
+
const CUA_APPS = /\bcua\.(getApp|getState|listApps|listWindows)\s*\(/;
|
|
13
|
+
const CUA_APP_NAME = /\bcua\.getApp\(\s*['"`]([^'"`]+)['"`]/;
|
|
14
|
+
export function agentComputerUseOf(name, input) {
|
|
15
|
+
const fields = typeof input === 'object' && input !== null ? input : {};
|
|
16
|
+
if (COMPUTER_SERVERS.test(name)) {
|
|
17
|
+
return { app: typeof fields.app === 'string' && fields.app.length > 0 ? fields.app : null };
|
|
18
|
+
}
|
|
19
|
+
if (name !== CUA_JS || typeof fields.code !== 'string' || !CUA_APPS.test(fields.code))
|
|
20
|
+
return undefined;
|
|
21
|
+
const named = CUA_APP_NAME.exec(fields.code);
|
|
22
|
+
return { app: named && named[1] ? named[1] : null };
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=agent-computer-use.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-computer-use.js","sourceRoot":"","sources":["../src/agent-computer-use.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;GAGG;AACH,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AACvD,8GAA8G;AAC9G,MAAM,MAAM,GAAG,mBAAmB,CAAC;AACnC,MAAM,QAAQ,GAAG,oDAAoD,CAAC;AACtE,MAAM,YAAY,GAAG,uCAAuC,CAAC;AAE7D,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,KAAc;IAC7D,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAE,KAAiC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrG,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,OAAO,EAAE,GAAG,EAAE,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9F,CAAC;IACD,IAAI,IAAI,KAAK,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACxG,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MoxxyEvent } from './events.js';
|
|
2
|
+
import type { ModelDescriptor } from './provider.js';
|
|
3
|
+
/**
|
|
4
|
+
* Where an agent connection records the context window its agent reports for a model
|
|
5
|
+
* (Codex's `modelContextWindow`, Claude's `modelUsage.contextWindow`), under
|
|
6
|
+
* `AGENT_CONNECTION_PLUGIN_ID`. It replaces the starting window from the model list,
|
|
7
|
+
* so every surface shows the window the agent really runs with.
|
|
8
|
+
*/
|
|
9
|
+
export declare const AGENT_CONTEXT_WINDOW_SUBTYPE = "context_window";
|
|
10
|
+
export interface RecordedContextWindow {
|
|
11
|
+
readonly provider: string;
|
|
12
|
+
readonly model: string;
|
|
13
|
+
readonly tokens: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function isContextWindowSize(tokens: unknown): tokens is number;
|
|
16
|
+
/** The window an event records, or undefined when it records something else. */
|
|
17
|
+
export declare function contextWindowOfEvent(event: MoxxyEvent): RecordedContextWindow | undefined;
|
|
18
|
+
/** The last window recorded for each model of the provider. */
|
|
19
|
+
export declare function recordedContextWindows(events: ReadonlyArray<MoxxyEvent>, provider: string): ReadonlyMap<string, number>;
|
|
20
|
+
/** The models with the windows the agent reported in place of their starting ones. */
|
|
21
|
+
export declare function withRecordedContextWindows(models: ReadonlyArray<ModelDescriptor>, windows: ReadonlyMap<string, number>): ReadonlyArray<ModelDescriptor>;
|
|
22
|
+
//# sourceMappingURL=agent-context-window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-context-window.d.ts","sourceRoot":"","sources":["../src/agent-context-window.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,mBAAmB,CAAC;AAE7D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAErE;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,qBAAqB,GAAG,SAAS,CAKzF;AAED,+DAA+D;AAC/D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAOvH;AAED,sFAAsF;AACtF,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,aAAa,CAAC,eAAe,CAAC,EACtC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,aAAa,CAAC,eAAe,CAAC,CAMhC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AGENT_CONNECTION_PLUGIN_ID } from './agent-step.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where an agent connection records the context window its agent reports for a model
|
|
4
|
+
* (Codex's `modelContextWindow`, Claude's `modelUsage.contextWindow`), under
|
|
5
|
+
* `AGENT_CONNECTION_PLUGIN_ID`. It replaces the starting window from the model list,
|
|
6
|
+
* so every surface shows the window the agent really runs with.
|
|
7
|
+
*/
|
|
8
|
+
export const AGENT_CONTEXT_WINDOW_SUBTYPE = 'context_window';
|
|
9
|
+
export function isContextWindowSize(tokens) {
|
|
10
|
+
return typeof tokens === 'number' && Number.isSafeInteger(tokens) && tokens > 0;
|
|
11
|
+
}
|
|
12
|
+
/** The window an event records, or undefined when it records something else. */
|
|
13
|
+
export function contextWindowOfEvent(event) {
|
|
14
|
+
if (event.type !== 'plugin_event' || event.pluginId !== AGENT_CONNECTION_PLUGIN_ID || event.subtype !== AGENT_CONTEXT_WINDOW_SUBTYPE)
|
|
15
|
+
return undefined;
|
|
16
|
+
const payload = event.payload;
|
|
17
|
+
if (!payload || typeof payload.provider !== 'string' || typeof payload.model !== 'string' || !isContextWindowSize(payload.tokens))
|
|
18
|
+
return undefined;
|
|
19
|
+
return { provider: payload.provider, model: payload.model, tokens: payload.tokens };
|
|
20
|
+
}
|
|
21
|
+
/** The last window recorded for each model of the provider. */
|
|
22
|
+
export function recordedContextWindows(events, provider) {
|
|
23
|
+
const windows = new Map();
|
|
24
|
+
for (const event of events) {
|
|
25
|
+
const recorded = contextWindowOfEvent(event);
|
|
26
|
+
if (recorded && recorded.provider === provider)
|
|
27
|
+
windows.set(recorded.model, recorded.tokens);
|
|
28
|
+
}
|
|
29
|
+
return windows;
|
|
30
|
+
}
|
|
31
|
+
/** The models with the windows the agent reported in place of their starting ones. */
|
|
32
|
+
export function withRecordedContextWindows(models, windows) {
|
|
33
|
+
if (windows.size === 0)
|
|
34
|
+
return models;
|
|
35
|
+
return models.map((model) => {
|
|
36
|
+
const tokens = windows.get(model.id);
|
|
37
|
+
return tokens === undefined || tokens === model.contextWindow ? model : { ...model, contextWindow: tokens };
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=agent-context-window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-context-window.js","sourceRoot":"","sources":["../src/agent-context-window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAI7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;AAQ7D,MAAM,UAAU,mBAAmB,CAAC,MAAe;IACjD,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;AAClF,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,oBAAoB,CAAC,KAAiB;IACpD,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,QAAQ,KAAK,0BAA0B,IAAI,KAAK,CAAC,OAAO,KAAK,4BAA4B;QAAE,OAAO,SAAS,CAAC;IACvJ,MAAM,OAAO,GAAG,KAAK,CAAC,OAAgD,CAAC;IACvE,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IACpJ,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AACtF,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,sBAAsB,CAAC,MAAiC,EAAE,QAAgB;IACxF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,0BAA0B,CACxC,MAAsC,EACtC,OAAoC;IAEpC,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IACtC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrC,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAC9G,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MoxxyEvent } from './events.js';
|
|
2
|
+
/**
|
|
3
|
+
* Recorded under `AGENT_CONNECTION_PLUGIN_ID` at the end of a turn the agent took up by
|
|
4
|
+
* itself ("Agent continued") in which it said nothing and ran nothing, so every surface
|
|
5
|
+
* says so instead of leaving the turn's marker alone in the chat.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AGENT_NO_REPLY_SUBTYPE = "no_reply";
|
|
8
|
+
/** How every surface words the note. */
|
|
9
|
+
export declare const AGENT_NO_REPLY_TEXT = "The agent finished without replying.";
|
|
10
|
+
export declare function isAgentNoReplyEvent(event: MoxxyEvent): boolean;
|
|
11
|
+
//# sourceMappingURL=agent-no-reply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-no-reply.d.ts","sourceRoot":"","sources":["../src/agent-no-reply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,aAAa,CAAC;AAEjD,wCAAwC;AACxC,eAAO,MAAM,mBAAmB,yCAAyC,CAAC;AAE1E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAE9D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AGENT_CONNECTION_PLUGIN_ID } from './agent-step.js';
|
|
2
|
+
/**
|
|
3
|
+
* Recorded under `AGENT_CONNECTION_PLUGIN_ID` at the end of a turn the agent took up by
|
|
4
|
+
* itself ("Agent continued") in which it said nothing and ran nothing, so every surface
|
|
5
|
+
* says so instead of leaving the turn's marker alone in the chat.
|
|
6
|
+
*/
|
|
7
|
+
export const AGENT_NO_REPLY_SUBTYPE = 'no_reply';
|
|
8
|
+
/** How every surface words the note. */
|
|
9
|
+
export const AGENT_NO_REPLY_TEXT = 'The agent finished without replying.';
|
|
10
|
+
export function isAgentNoReplyEvent(event) {
|
|
11
|
+
return event.type === 'plugin_event' && event.pluginId === AGENT_CONNECTION_PLUGIN_ID && event.subtype === AGENT_NO_REPLY_SUBTYPE;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=agent-no-reply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-no-reply.js","sourceRoot":"","sources":["../src/agent-no-reply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAG7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAEjD,wCAAwC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AAE1E,MAAM,UAAU,mBAAmB,CAAC,KAAiB;IACnD,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,QAAQ,KAAK,0BAA0B,IAAI,KAAK,CAAC,OAAO,KAAK,sBAAsB,CAAC;AACpI,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MoxxyEvent } from './events.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where an agent connection keeps the vendor agent's session in the log. The
|
|
4
|
+
* `agentStep` contract itself is part of the provider types (`provider.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const AGENT_CONNECTION_PLUGIN_ID: import("./ids.js").PluginId;
|
|
7
|
+
export declare const AGENT_SESSION_SUBTYPE = "agent_session";
|
|
8
|
+
/** The state of the agent's own goal (Claude `/goal`, Codex `thread/goal`), recorded after its turn. */
|
|
9
|
+
export declare const AGENT_GOAL_SUBTYPE = "goal_status";
|
|
10
|
+
/** Where subagents are recorded, the agent's own as well as Moxxy's (`@moxxy/core` writes the same envelope). */
|
|
11
|
+
export declare const SUBAGENTS_PLUGIN_ID: import("./ids.js").PluginId;
|
|
12
|
+
/** The agent session to resume for this provider: the last one recorded, if any. */
|
|
13
|
+
export declare function agentSessionFromEvents(events: ReadonlyArray<MoxxyEvent>, provider: string): string | undefined;
|
|
14
|
+
//# sourceMappingURL=agent-step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-step.d.ts","sourceRoot":"","sources":["../src/agent-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C;;;GAGG;AAEH,eAAO,MAAM,0BAA0B,6BAAwC,CAAC;AAChF,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AACrD,wGAAwG;AACxG,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAChD,iHAAiH;AACjH,eAAO,MAAM,mBAAmB,6BAAiC,CAAC;AAElE,oFAAoF;AACpF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAS9G"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { asPluginId } from './ids.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where an agent connection keeps the vendor agent's session in the log. The
|
|
4
|
+
* `agentStep` contract itself is part of the provider types (`provider.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export const AGENT_CONNECTION_PLUGIN_ID = asPluginId('@moxxy/agent-connection');
|
|
7
|
+
export const AGENT_SESSION_SUBTYPE = 'agent_session';
|
|
8
|
+
/** The state of the agent's own goal (Claude `/goal`, Codex `thread/goal`), recorded after its turn. */
|
|
9
|
+
export const AGENT_GOAL_SUBTYPE = 'goal_status';
|
|
10
|
+
/** Where subagents are recorded, the agent's own as well as Moxxy's (`@moxxy/core` writes the same envelope). */
|
|
11
|
+
export const SUBAGENTS_PLUGIN_ID = asPluginId('@moxxy/subagents');
|
|
12
|
+
/** The agent session to resume for this provider: the last one recorded, if any. */
|
|
13
|
+
export function agentSessionFromEvents(events, provider) {
|
|
14
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
15
|
+
const event = events[i];
|
|
16
|
+
if (!event || event.type !== 'plugin_event')
|
|
17
|
+
continue;
|
|
18
|
+
if (event.pluginId !== AGENT_CONNECTION_PLUGIN_ID || event.subtype !== AGENT_SESSION_SUBTYPE)
|
|
19
|
+
continue;
|
|
20
|
+
const payload = event.payload;
|
|
21
|
+
if (payload && payload.provider === provider && typeof payload.sessionId === 'string')
|
|
22
|
+
return payload.sessionId;
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=agent-step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-step.js","sourceRoot":"","sources":["../src/agent-step.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AACrD,wGAAwG;AACxG,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAChD,iHAAiH;AACjH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAElE,oFAAoF;AACpF,MAAM,UAAU,sBAAsB,CAAC,MAAiC,EAAE,QAAgB;IACxF,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;YAAE,SAAS;QACtD,IAAI,KAAK,CAAC,QAAQ,KAAK,0BAA0B,IAAI,KAAK,CAAC,OAAO,KAAK,qBAAqB;YAAE,SAAS;QACvG,MAAM,OAAO,GAAG,KAAK,CAAC,OAA6D,CAAC;QACpF,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,SAAS,CAAC;IAClH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PluginId } from './ids.js';
|
|
2
|
+
import type { MoxxyEvent } from './events.js';
|
|
3
|
+
import type { AgentStepEvent } from './provider.js';
|
|
4
|
+
/** Everything the agent runs in the background now (`AGENT_CONNECTION_PLUGIN_ID`); each record replaces the one before. */
|
|
5
|
+
export declare const AGENT_BACKGROUND_WORK_SUBTYPE = "background_work";
|
|
6
|
+
/** One background work ended (`AGENT_CONNECTION_PLUGIN_ID`), with what it printed last. */
|
|
7
|
+
export declare const AGENT_BACKGROUND_WORK_ENDED_SUBTYPE = "background_work_ended";
|
|
8
|
+
/** What a subagent said as it worked (`SUBAGENTS_PLUGIN_ID`). */
|
|
9
|
+
export declare const SUBAGENT_MESSAGE_SUBTYPE = "subagent_message";
|
|
10
|
+
/** How much of a command's output a `background_work_ended` keeps: its end, which says how it went. */
|
|
11
|
+
export declare const AGENT_WORK_OUTPUT_LIMIT = 4096;
|
|
12
|
+
/** A record of the agent's background work (its list, an end): read by the Agents pane, never drawn in the chat. */
|
|
13
|
+
export declare function isAgentWorkEvent(event: MoxxyEvent): boolean;
|
|
14
|
+
/** A record of a helper agent (its start, steps, words, end), from Moxxy's own subagents or an agent connection's. */
|
|
15
|
+
export declare function isSubagentEvent(event: MoxxyEvent): boolean;
|
|
16
|
+
/** A `plugin_event` without its envelope (session, turn, id, time). */
|
|
17
|
+
export interface AgentActivityRecord {
|
|
18
|
+
readonly source: 'plugin' | 'system';
|
|
19
|
+
readonly pluginId: PluginId;
|
|
20
|
+
readonly subtype: string;
|
|
21
|
+
readonly payload: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
/** The helpers of a conversation by id, kept to name them in the records of their later events. */
|
|
24
|
+
export type SubagentNames = Map<string, {
|
|
25
|
+
readonly label: string;
|
|
26
|
+
readonly agentType: string;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* How an agent's helpers and background work are recorded in the log, the
|
|
30
|
+
* same whether they come in a turn or between turns; `undefined` for any
|
|
31
|
+
* other event.
|
|
32
|
+
*/
|
|
33
|
+
export declare function agentActivityRecord(event: AgentStepEvent, provider: string, names: SubagentNames): AgentActivityRecord | undefined;
|
|
34
|
+
//# sourceMappingURL=agent-work.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-work.d.ts","sourceRoot":"","sources":["../src/agent-work.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAA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before. */
|
|
3
|
+
export const AGENT_BACKGROUND_WORK_SUBTYPE = 'background_work';
|
|
4
|
+
/** One background work ended (`AGENT_CONNECTION_PLUGIN_ID`), with what it printed last. */
|
|
5
|
+
export const AGENT_BACKGROUND_WORK_ENDED_SUBTYPE = 'background_work_ended';
|
|
6
|
+
/** What a subagent said as it worked (`SUBAGENTS_PLUGIN_ID`). */
|
|
7
|
+
export const SUBAGENT_MESSAGE_SUBTYPE = 'subagent_message';
|
|
8
|
+
/** How much of a command's output a `background_work_ended` keeps: its end, which says how it went. */
|
|
9
|
+
export const AGENT_WORK_OUTPUT_LIMIT = 4096;
|
|
10
|
+
/** A record of the agent's background work (its list, an end): read by the Agents pane, never drawn in the chat. */
|
|
11
|
+
export function isAgentWorkEvent(event) {
|
|
12
|
+
return (event.type === 'plugin_event' &&
|
|
13
|
+
event.pluginId === AGENT_CONNECTION_PLUGIN_ID &&
|
|
14
|
+
(event.subtype === AGENT_BACKGROUND_WORK_SUBTYPE || event.subtype === AGENT_BACKGROUND_WORK_ENDED_SUBTYPE));
|
|
15
|
+
}
|
|
16
|
+
/** A record of a helper agent (its start, steps, words, end), from Moxxy's own subagents or an agent connection's. */
|
|
17
|
+
export function isSubagentEvent(event) {
|
|
18
|
+
return event.type === 'plugin_event' && event.pluginId === SUBAGENTS_PLUGIN_ID;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* How an agent's helpers and background work are recorded in the log, the
|
|
22
|
+
* same whether they come in a turn or between turns; `undefined` for any
|
|
23
|
+
* other event.
|
|
24
|
+
*/
|
|
25
|
+
export function agentActivityRecord(event, provider, names) {
|
|
26
|
+
switch (event.type) {
|
|
27
|
+
case 'subagent_started':
|
|
28
|
+
names.set(event.id, { label: event.label, agentType: event.agentType });
|
|
29
|
+
return subagentRecord('subagent_started', {
|
|
30
|
+
childSessionId: event.id,
|
|
31
|
+
label: event.label,
|
|
32
|
+
agentType: event.agentType,
|
|
33
|
+
...(event.prompt ? { prompt: event.prompt } : {}),
|
|
34
|
+
...(event.toolsUnseen ? { toolsUnseen: true } : {}),
|
|
35
|
+
});
|
|
36
|
+
case 'subagent_tool_call': {
|
|
37
|
+
const named = names.get(event.id);
|
|
38
|
+
return subagentRecord('subagent_tool_call', { childSessionId: event.id, ...(named ? { label: named.label } : {}), name: event.name, input: event.input });
|
|
39
|
+
}
|
|
40
|
+
case 'subagent_message': {
|
|
41
|
+
const named = names.get(event.id);
|
|
42
|
+
return subagentRecord(SUBAGENT_MESSAGE_SUBTYPE, { childSessionId: event.id, ...(named ? { label: named.label } : {}), text: event.text });
|
|
43
|
+
}
|
|
44
|
+
case 'subagent_completed': {
|
|
45
|
+
const named = names.get(event.id);
|
|
46
|
+
return subagentRecord('subagent_completed', {
|
|
47
|
+
childSessionId: event.id,
|
|
48
|
+
...(named ? { label: named.label, agentType: named.agentType } : {}),
|
|
49
|
+
text: event.text,
|
|
50
|
+
stopReason: event.stopped ? 'stopped' : event.error ? 'error' : 'end_turn',
|
|
51
|
+
...(event.tokensUsed !== undefined ? { tokensUsed: event.tokensUsed } : {}),
|
|
52
|
+
...(event.error ? { error: event.error } : {}),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
case 'background_work':
|
|
56
|
+
return workRecord(AGENT_BACKGROUND_WORK_SUBTYPE, { provider, work: event.work.map(({ id, kind, label }) => ({ id, kind, label })) });
|
|
57
|
+
case 'background_work_ended':
|
|
58
|
+
return workRecord(AGENT_BACKGROUND_WORK_ENDED_SUBTYPE, {
|
|
59
|
+
provider,
|
|
60
|
+
id: event.id,
|
|
61
|
+
kind: event.kind,
|
|
62
|
+
label: event.label,
|
|
63
|
+
status: event.status,
|
|
64
|
+
...(event.summary ? { summary: event.summary } : {}),
|
|
65
|
+
...(event.output ? { output: outputEnd(event.output) } : {}),
|
|
66
|
+
});
|
|
67
|
+
default:
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function subagentRecord(subtype, payload) {
|
|
72
|
+
return { source: 'plugin', pluginId: SUBAGENTS_PLUGIN_ID, subtype, payload };
|
|
73
|
+
}
|
|
74
|
+
function workRecord(subtype, payload) {
|
|
75
|
+
return { source: 'system', pluginId: AGENT_CONNECTION_PLUGIN_ID, subtype, payload };
|
|
76
|
+
}
|
|
77
|
+
function outputEnd(output) {
|
|
78
|
+
return output.length <= AGENT_WORK_OUTPUT_LIMIT ? output : output.slice(-AGENT_WORK_OUTPUT_LIMIT);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=agent-work.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-work.js","sourceRoot":"","sources":["../src/agent-work.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKlF,2HAA2H;AAC3H,MAAM,CAAC,MAAM,6BAA6B,GAAG,iBAAiB,CAAC;AAC/D,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAC3E,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAC3D,uGAAuG;AACvG,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,oHAAoH;AACpH,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,cAAc;QAC7B,KAAK,CAAC,QAAQ,KAAK,0BAA0B;QAC7C,CAAC,KAAK,CAAC,OAAO,KAAK,6BAA6B,IAAI,KAAK,CAAC,OAAO,KAAK,mCAAmC,CAAC,CAC3G,CAAC;AACJ,CAAC;AAED,sHAAsH;AACtH,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,QAAQ,KAAK,mBAAmB,CAAC;AACjF,CAAC;AAaD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC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Attachment bytes travel two very different roads. The model needs them in
|
|
4
|
-
* full; a client that only DRAWS the conversation (desktop,
|
|
4
|
+
* full; a client that only DRAWS the conversation (desktop, a channel
|
|
5
5
|
* bot) does not, and pushing a scanned 30 MB PDF through the client link on
|
|
6
6
|
* every reconnect is what once wedged a chat in a reconnect loop. So the runner
|
|
7
7
|
* sends clients {@link eventForClient} — large payloads swapped for their size —
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Attachment bytes travel two very different roads. The model needs them in
|
|
3
|
-
* full; a client that only DRAWS the conversation (desktop,
|
|
3
|
+
* full; a client that only DRAWS the conversation (desktop, a channel
|
|
4
4
|
* bot) does not, and pushing a scanned 30 MB PDF through the client link on
|
|
5
5
|
* every reconnect is what once wedged a chat in a reconnect loop. So the runner
|
|
6
6
|
* sends clients {@link eventForClient} — large payloads swapped for their size —
|
package/dist/auto-approve.d.ts
CHANGED
|
@@ -7,8 +7,17 @@ import type { MoxxyEvent } from './events.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const AUTO_APPROVE_PLUGIN_ID: import("./ids.js").PluginId;
|
|
9
9
|
export declare const AUTO_APPROVE_SUBTYPE = "auto_approve";
|
|
10
|
+
/**
|
|
11
|
+
* An agent connection undid a change made outside Moxxy that let the agent act
|
|
12
|
+
* without asking: a note for the person, not a switch (the state stays as it was).
|
|
13
|
+
*/
|
|
14
|
+
export declare const AUTO_APPROVE_RESTORED_SUBTYPE = "auto_approve_restored";
|
|
10
15
|
/** The on/off an event records, or null when it isn't an auto-approve switch. */
|
|
11
16
|
export declare function autoApproveSwitch(event: MoxxyEvent): boolean | null;
|
|
12
17
|
/** A conversation's auto-approve state: the last recorded switch wins; off until one is recorded. */
|
|
13
18
|
export declare function autoApproveFromEvents(events: ReadonlyArray<MoxxyEvent>): boolean;
|
|
19
|
+
/** Whether the conversation recorded any switch (the person's, or the agent's own setup Moxxy took on): until then its agent's own setup shows. */
|
|
20
|
+
export declare function autoApproveRecorded(events: ReadonlyArray<MoxxyEvent>): boolean;
|
|
21
|
+
/** Whether the switch in force is the agent's own setup Moxxy took on (recorded by the system), not the person's choice. */
|
|
22
|
+
export declare function autoApproveFromAgent(events: ReadonlyArray<MoxxyEvent>): boolean;
|
|
14
23
|
//# sourceMappingURL=auto-approve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-approve.d.ts","sourceRoot":"","sources":["../src/auto-approve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,6BAAoC,CAAC;AACxE,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"auto-approve.d.ts","sourceRoot":"","sources":["../src/auto-approve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,6BAAoC,CAAC;AACxE,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AACnD;;;GAGG;AACH,eAAO,MAAM,6BAA6B,0BAA0B,CAAC;AAErE,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,GAAG,IAAI,CAKnE;AAED,qGAAqG;AACrG,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,OAAO,CAOhF;AAED,mJAAmJ;AACnJ,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,OAAO,CAE9E;AAED,4HAA4H;AAC5H,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,OAAO,CAM/E"}
|
package/dist/auto-approve.js
CHANGED
|
@@ -7,6 +7,11 @@ import { asPluginId } from './ids.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export const AUTO_APPROVE_PLUGIN_ID = asPluginId('@moxxy/auto-approve');
|
|
9
9
|
export const AUTO_APPROVE_SUBTYPE = 'auto_approve';
|
|
10
|
+
/**
|
|
11
|
+
* An agent connection undid a change made outside Moxxy that let the agent act
|
|
12
|
+
* without asking: a note for the person, not a switch (the state stays as it was).
|
|
13
|
+
*/
|
|
14
|
+
export const AUTO_APPROVE_RESTORED_SUBTYPE = 'auto_approve_restored';
|
|
10
15
|
/** The on/off an event records, or null when it isn't an auto-approve switch. */
|
|
11
16
|
export function autoApproveSwitch(event) {
|
|
12
17
|
if (event.type !== 'plugin_event')
|
|
@@ -26,4 +31,17 @@ export function autoApproveFromEvents(events) {
|
|
|
26
31
|
}
|
|
27
32
|
return false;
|
|
28
33
|
}
|
|
34
|
+
/** Whether the conversation recorded any switch (the person's, or the agent's own setup Moxxy took on): until then its agent's own setup shows. */
|
|
35
|
+
export function autoApproveRecorded(events) {
|
|
36
|
+
return events.some((event) => autoApproveSwitch(event) !== null);
|
|
37
|
+
}
|
|
38
|
+
/** Whether the switch in force is the agent's own setup Moxxy took on (recorded by the system), not the person's choice. */
|
|
39
|
+
export function autoApproveFromAgent(events) {
|
|
40
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
41
|
+
const event = events[i];
|
|
42
|
+
if (event && autoApproveSwitch(event) !== null)
|
|
43
|
+
return event.source !== 'user';
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
29
47
|
//# sourceMappingURL=auto-approve.js.map
|
package/dist/auto-approve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-approve.js","sourceRoot":"","sources":["../src/auto-approve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,oBAAoB,G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nE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;AACnE,CAAC;AAED,4HAA4H;AAC5H,MAAM,UAAU,oBAAoB,CAAC,MAAiC;IACpE,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,KAAK,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/channel-auth.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* cannot set an `Authorization` header (browser / React Native), so the
|
|
15
15
|
* secret stays out of the URL (query strings leak via logs and QR/stdout).
|
|
16
16
|
*
|
|
17
|
-
* Channels that expose a network surface (
|
|
17
|
+
* Channels that expose a network surface (HTTP, web) should
|
|
18
18
|
* resolve their token with the former and gate connections with the latter,
|
|
19
19
|
* so the `channels.<name>.token` config + `MOXXY_<NAME>_TOKEN` env conventions
|
|
20
20
|
* are uniform across every channel.
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
export interface ChannelTokenOptions {
|
|
23
23
|
/** Explicit token from channel config (`channels.<name>.token`). */
|
|
24
24
|
readonly configured?: string;
|
|
25
|
-
/** Env var checked first, e.g. `
|
|
25
|
+
/** Env var checked first, e.g. `MOXXY_HTTP_TOKEN`. */
|
|
26
26
|
readonly envVar?: string;
|
|
27
|
-
/** File to persist a generated token, e.g. `
|
|
27
|
+
/** File to persist a generated token, e.g. `http-token`. */
|
|
28
28
|
readonly fileName: string;
|
|
29
29
|
/** Directory the token file lives under. Defaults to the moxxy home dir;
|
|
30
30
|
* the desktop bridge passes its Electron `userData` dir here instead. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-auth.d.ts","sourceRoot":"","sources":["../src/channel-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,
|
|
1
|
+
{"version":3,"file":"channel-auth.d.ts","sourceRoot":"","sources":["../src/channel-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;8EAC0E;IAC1E,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAoDD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAkBrE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,mBAAmB,EAAE,KAAK,GAAG,UAAU,CAAC,GAAG,MAAM,CAI9F;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,KAAK,OAAO,CAE/F;AAED;2EAC2E;AAC3E,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C;;4DAE4D;AAC5D,eAAO,MAAM,+BAA+B,kBAAkB,CAAC;AAE/D;oFACoF;AACpF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED;6EAC6E;AAC7E,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAYnF"}
|
package/dist/channel-auth.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* cannot set an `Authorization` header (browser / React Native), so the
|
|
15
15
|
* secret stays out of the URL (query strings leak via logs and QR/stdout).
|
|
16
16
|
*
|
|
17
|
-
* Channels that expose a network surface (
|
|
17
|
+
* Channels that expose a network surface (HTTP, web) should
|
|
18
18
|
* resolve their token with the former and gate connections with the latter,
|
|
19
19
|
* so the `channels.<name>.token` config + `MOXXY_<NAME>_TOKEN` env conventions
|
|
20
20
|
* are uniform across every channel.
|
package/dist/channel.d.ts
CHANGED
|
@@ -222,7 +222,7 @@ export interface ChannelConnectStep {
|
|
|
222
222
|
/**
|
|
223
223
|
* Presentation of the channel's runtime connect value:
|
|
224
224
|
* - `qr`: render a QR of the value plus the value itself (e.g. scan/open a
|
|
225
|
-
* `t.me/<bot>` link
|
|
225
|
+
* `t.me/<bot>` link).
|
|
226
226
|
* - `url`: show the value as a copyable URL the user pastes elsewhere
|
|
227
227
|
* (Slack's Events Request URL).
|
|
228
228
|
* - `instructions`: static `steps`, no runtime value.
|