@bastani/atomic 0.9.16-alpha.7 → 0.9.16-alpha.8
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/CHANGELOG.md +19 -0
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/README.md +4 -4
- package/dist/builtin/intercom/broker/broker.ts +617 -22
- package/dist/builtin/intercom/broker/client-message-validation.ts +9 -0
- package/dist/builtin/intercom/broker/client.ts +200 -10
- package/dist/builtin/intercom/broker/pending-send-registry.ts +4 -0
- package/dist/builtin/intercom/broker/send-handler.ts +90 -36
- package/dist/builtin/intercom/broker/send-signature.ts +20 -8
- package/dist/builtin/intercom/group.ts +85 -0
- package/dist/builtin/intercom/index.bundle.mjs +680 -53
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/session-target.ts +54 -0
- package/dist/builtin/intercom/skills/intercom/SKILL.md +18 -3
- package/dist/builtin/intercom/source-ownership.ts +31 -0
- package/dist/builtin/intercom/types.ts +115 -0
- package/dist/builtin/mcp/index.bundle.mjs +109 -35
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +173 -51
- package/dist/builtin/web-access/index.bundle.mjs +109 -35
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +15 -0
- package/dist/builtin/workflows/README.md +40 -37
- package/dist/builtin/workflows/builtin/adversarial-verification.js +13 -0
- package/dist/builtin/workflows/builtin/{shared-prompts.ts → chunk-0x6e303p.js} +133 -154
- package/dist/builtin/workflows/builtin/chunk-29wrp38a.js +199 -0
- package/dist/builtin/workflows/builtin/chunk-2dqb5s2q.js +602 -0
- package/dist/builtin/workflows/builtin/chunk-4febxsv4.js +264 -0
- package/dist/builtin/workflows/builtin/chunk-5n10x7j2.js +69730 -0
- package/dist/builtin/workflows/builtin/chunk-5wgwscd0.js +4 -0
- package/dist/builtin/workflows/builtin/chunk-6fqs7c01.js +155 -0
- package/dist/builtin/workflows/builtin/chunk-7430zyas.js +126 -0
- package/dist/builtin/workflows/builtin/chunk-7at6dnkr.js +33 -0
- package/dist/builtin/workflows/builtin/chunk-82ha8p41.js +175 -0
- package/dist/builtin/workflows/builtin/chunk-bfkmzv9h.js +156 -0
- package/dist/builtin/workflows/builtin/chunk-c53y8bdh.js +345 -0
- package/dist/builtin/workflows/builtin/chunk-cdtd3m3w.js +529 -0
- package/dist/builtin/workflows/builtin/chunk-cg9tmks0.js +206 -0
- package/dist/builtin/workflows/builtin/chunk-hdpj1dkw.js +2447 -0
- package/dist/builtin/workflows/builtin/chunk-hzzn6adg.js +221 -0
- package/dist/builtin/workflows/builtin/chunk-nqr34qp3.js +1061 -0
- package/dist/builtin/workflows/builtin/chunk-qwzvgxnq.js +404 -0
- package/dist/builtin/workflows/builtin/chunk-qx2ptjs3.js +215 -0
- package/dist/builtin/workflows/builtin/chunk-v04c5qmd.js +1207 -0
- package/dist/builtin/workflows/builtin/chunk-wpckd35c.js +12 -0
- package/dist/builtin/workflows/builtin/chunk-x2ghn0je.js +4110 -0
- package/dist/builtin/workflows/builtin/chunk-zf28603f.js +1080 -0
- package/dist/builtin/workflows/builtin/classify-and-act.js +12 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +10 -0
- package/dist/builtin/workflows/builtin/generate-and-filter.js +12 -0
- package/dist/builtin/workflows/builtin/goal.js +16 -0
- package/dist/builtin/workflows/builtin/index.js +49 -0
- package/dist/builtin/workflows/builtin/loop-until-done.js +12 -0
- package/dist/builtin/workflows/builtin/open-claude-design.js +11 -0
- package/dist/builtin/workflows/builtin/ralph.js +16 -0
- package/dist/builtin/workflows/builtin/steering-context.d.ts +6 -0
- package/dist/builtin/workflows/builtin/steering-context.js +7 -0
- package/dist/builtin/workflows/builtin/tournament.js +13 -0
- package/dist/builtin/workflows/package.json +10 -7
- package/dist/builtin/workflows/src/authoring/typebox-defaults.d.ts +41 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +1228 -428
- package/dist/builtin/workflows/src/{index.bundle.mjs → index.js} +956 -427
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +403 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +327 -0
- package/dist/builtin/workflows/src/shared/budget.d.ts +67 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +60 -0
- package/dist/builtin/workflows/src/shared/workflow-heartbeat-contract.d.ts +21 -0
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +12 -5
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +2 -0
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +2 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +4 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/builtin-install-layout.d.ts +1 -1
- package/dist/core/builtin-install-layout.d.ts.map +1 -1
- package/dist/core/builtin-install-layout.js +1 -1
- package/dist/core/builtin-install-layout.js.map +1 -1
- package/dist/core/codex-fast-mode.d.ts +10 -7
- package/dist/core/codex-fast-mode.d.ts.map +1 -1
- package/dist/core/codex-fast-mode.js +31 -13
- package/dist/core/codex-fast-mode.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +35 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +6 -1
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +4 -0
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +1 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +8 -0
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +5 -5
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-storage.d.ts +2 -0
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-storage.js +4 -2
- package/dist/core/session-manager-storage.js.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +6 -1
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +8 -9
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +1 -1
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +4 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +69 -10
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +18 -2
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js +33 -5
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +8 -4
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +13 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/intercom.md +15 -6
- package/docs/packages.md +2 -2
- package/docs/providers.md +8 -3
- package/docs/quickstart.md +2 -2
- package/docs/rpc.md +21 -4
- package/docs/settings.md +6 -4
- package/docs/subagents.md +1 -1
- package/docs/usage.md +1 -1
- package/docs/workflows.md +108 -239
- package/npm-shrinkwrap.json +32 -32
- package/package.json +9 -13
- package/dist/builtin/workflows/ambient.d.ts +0 -61
- package/dist/builtin/workflows/builtin/adversarial-verification-prompts.ts +0 -26
- package/dist/builtin/workflows/builtin/adversarial-verification-runner.ts +0 -391
- package/dist/builtin/workflows/builtin/adversarial-verification.ts +0 -34
- package/dist/builtin/workflows/builtin/classify-and-act-prompts.ts +0 -14
- package/dist/builtin/workflows/builtin/classify-and-act-runner.ts +0 -108
- package/dist/builtin/workflows/builtin/classify-and-act.ts +0 -40
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize-prompts.ts +0 -14
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize-runner.ts +0 -96
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.ts +0 -37
- package/dist/builtin/workflows/builtin/generate-and-filter-prompts.ts +0 -41
- package/dist/builtin/workflows/builtin/generate-and-filter-runner.ts +0 -90
- package/dist/builtin/workflows/builtin/generate-and-filter.ts +0 -31
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +0 -64
- package/dist/builtin/workflows/builtin/goal-convergence.ts +0 -87
- package/dist/builtin/workflows/builtin/goal-ledger.ts +0 -139
- package/dist/builtin/workflows/builtin/goal-models.ts +0 -72
- package/dist/builtin/workflows/builtin/goal-orchestrator-prompts.ts +0 -94
- package/dist/builtin/workflows/builtin/goal-prompts.ts +0 -217
- package/dist/builtin/workflows/builtin/goal-reducer.ts +0 -176
- package/dist/builtin/workflows/builtin/goal-reports.ts +0 -76
- package/dist/builtin/workflows/builtin/goal-reverify.ts +0 -305
- package/dist/builtin/workflows/builtin/goal-review.ts +0 -139
- package/dist/builtin/workflows/builtin/goal-runner.ts +0 -504
- package/dist/builtin/workflows/builtin/goal-schemas.ts +0 -89
- package/dist/builtin/workflows/builtin/goal-types.ts +0 -164
- package/dist/builtin/workflows/builtin/goal.ts +0 -78
- package/dist/builtin/workflows/builtin/index.ts +0 -16
- package/dist/builtin/workflows/builtin/loop-until-done-prompts.ts +0 -87
- package/dist/builtin/workflows/builtin/loop-until-done-runner.ts +0 -282
- package/dist/builtin/workflows/builtin/loop-until-done.ts +0 -51
- package/dist/builtin/workflows/builtin/open-claude-design-live-protocol.ts +0 -305
- package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +0 -337
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +0 -347
- package/dist/builtin/workflows/builtin/open-claude-design-setup.ts +0 -313
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +0 -311
- package/dist/builtin/workflows/builtin/open-claude-design.ts +0 -57
- package/dist/builtin/workflows/builtin/pattern-artifact-root.ts +0 -28
- package/dist/builtin/workflows/builtin/progress-scoring.ts +0 -230
- package/dist/builtin/workflows/builtin/ralph-core.ts +0 -449
- package/dist/builtin/workflows/builtin/ralph-forked-prompts.ts +0 -100
- package/dist/builtin/workflows/builtin/ralph-models.ts +0 -183
- package/dist/builtin/workflows/builtin/ralph-review-gate.ts +0 -103
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +0 -104
- package/dist/builtin/workflows/builtin/ralph-runner.ts +0 -459
- package/dist/builtin/workflows/builtin/ralph.ts +0 -82
- package/dist/builtin/workflows/builtin/review-convergence.ts +0 -229
- package/dist/builtin/workflows/builtin/selection-math.ts +0 -156
- package/dist/builtin/workflows/builtin/steering-context.ts +0 -51
- package/dist/builtin/workflows/builtin/tournament-prompts.ts +0 -70
- package/dist/builtin/workflows/builtin/tournament-runner.ts +0 -400
- package/dist/builtin/workflows/builtin/tournament.ts +0 -73
- package/dist/builtin/workflows/builtin/verification-criteria.ts +0 -330
- package/dist/builtin/workflows/builtin/verification-prompts.ts +0 -206
- package/dist/builtin/workflows/builtin/verification-usage.ts +0 -44
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/intercom",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
|
|
6
6
|
"contributors": [
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { SessionInfo } from "./types.js";
|
|
2
|
+
|
|
3
|
+
export type SessionTargetResolution =
|
|
4
|
+
| { kind: "resolved"; session: SessionInfo }
|
|
5
|
+
| { kind: "ambiguous_name"; matches: readonly SessionInfo[] }
|
|
6
|
+
| { kind: "not_found" };
|
|
7
|
+
|
|
8
|
+
/** Resolve an Intercom session by exact ID or exact case-insensitive name. */
|
|
9
|
+
export function resolveSessionTarget(
|
|
10
|
+
sessions: readonly SessionInfo[],
|
|
11
|
+
nameOrId: string,
|
|
12
|
+
): SessionTargetResolution {
|
|
13
|
+
const target = nameOrId.trim();
|
|
14
|
+
const exactId = sessions.find((session) => session.id === target);
|
|
15
|
+
if (exactId !== undefined) return { kind: "resolved", session: exactId };
|
|
16
|
+
|
|
17
|
+
const lowerTarget = target.toLowerCase();
|
|
18
|
+
const exactNames = sessions.filter(
|
|
19
|
+
(session) => session.name?.toLowerCase() === lowerTarget,
|
|
20
|
+
);
|
|
21
|
+
if (exactNames.length === 1) {
|
|
22
|
+
return { kind: "resolved", session: exactNames[0]! };
|
|
23
|
+
}
|
|
24
|
+
if (exactNames.length > 1) {
|
|
25
|
+
return { kind: "ambiguous_name", matches: exactNames };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return { kind: "not_found" };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function sessionTargetFailureReason(
|
|
32
|
+
target: string,
|
|
33
|
+
resolution: Exclude<SessionTargetResolution, { kind: "resolved" }>,
|
|
34
|
+
): string {
|
|
35
|
+
if (resolution.kind === "ambiguous_name") {
|
|
36
|
+
return `Multiple sessions named "${target}" are connected. Use the session ID instead.`;
|
|
37
|
+
}
|
|
38
|
+
return "Session not found";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface SessionListingClient {
|
|
42
|
+
listSessions(): Promise<SessionInfo[]>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Resolve a target through the broker's current session list. */
|
|
46
|
+
export async function resolveSessionTargetId(
|
|
47
|
+
client: SessionListingClient,
|
|
48
|
+
nameOrId: string,
|
|
49
|
+
): Promise<string | null> {
|
|
50
|
+
const resolution = resolveSessionTarget(await client.listSessions(), nameOrId);
|
|
51
|
+
if (resolution.kind === "resolved") return resolution.session.id;
|
|
52
|
+
if (resolution.kind === "not_found") return null;
|
|
53
|
+
throw new Error(sessionTargetFailureReason(nameOrId, resolution));
|
|
54
|
+
}
|
|
@@ -75,7 +75,22 @@ intercom({ action: "list" })
|
|
|
75
75
|
intercom({ action: "ask", to: "6332faab-1111-4222-8333-123456789abc", message: "Which option should I use?" })
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Live sessions accept an exact full session ID or exact case-insensitive name. Ordinary `send` to a known workflow stage whose session has not initialized uses the exact `<runId>:<stageKey>` identity. Unknown runs and stages retain the ordinary unknown-target failure.
|
|
79
|
+
|
|
80
|
+
### Deliver to workflow stages that have not started
|
|
81
|
+
|
|
82
|
+
Send material updates through Intercom to every affected workflow stage, including stages that have not started. Atomic queues messages for known pending stages and delivers them when their sessions initialize:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
intercom({
|
|
86
|
+
action: "send",
|
|
87
|
+
to: "<runId>:reviewer",
|
|
88
|
+
message: "Scope changed: preserve raw amendment text in the verification oracle."
|
|
89
|
+
})
|
|
90
|
+
// → queued, distinct from live-session delivered, with the FIFO position
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The stage receives the ordinary inbound Intercom message before its first model turn under **Messages received before you started**, with real sender identity and a `Sent:` timestamp. Only same-workflow-group sessions may queue messages. Each exact run/stage key holds at most 50 queued messages; the next send is refused rather than evicting one. Resume/replay, broker restart, and stage-attempt restart preserve exactly-once delivery. If the stage is skipped, cancelled, or becomes terminal before its session initializes, the message becomes undeliverable and acknowledgment-requesting senders receive a correlated failure. Do not use `ask`: Atomic returns `pending_stage_ask_unsupported` and recommends ordinary `send` instead of holding an unbounded waiter.
|
|
79
94
|
|
|
80
95
|
### Runtime named groups
|
|
81
96
|
|
|
@@ -230,8 +245,8 @@ In Atomic workflows, each invocation has its own Intercom group, and parallel st
|
|
|
230
245
|
|--------|----------|----------|
|
|
231
246
|
| `join` | Joins or creates a named group in place | Two plain chat sessions need a private group |
|
|
232
247
|
| `leave` | Returns to the resolved home group | Restore the session's startup group |
|
|
233
|
-
| `send` | Fire-and-forget | You don't need a response |
|
|
234
|
-
| `ask` | Blocks until
|
|
248
|
+
| `send` | Fire-and-forget to a live session, or durable `queued` delivery to `<runId>:<stageKey>` before a workflow stage starts | You don't need a response |
|
|
249
|
+
| `ask` | Blocks until a live recipient replies (10 min timeout); refused for an unstarted stage | You need an answer to continue |
|
|
235
250
|
| `reply` | Responds to the active or pending inbound ask; `to` accepts an exact full session ID or exact session name | You were asked something and need to answer naturally |
|
|
236
251
|
| `pending` | Lists unresolved inbound asks | You need to see who is waiting before replying |
|
|
237
252
|
| `list` | Returns all sessions in the current group with full session IDs and live status | You need to discover targets or choose an idle peer |
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type SubagentChildPolicy } from "@bastani/atomic";
|
|
2
|
+
import type { Message } from "./types.js";
|
|
3
|
+
|
|
4
|
+
export function buildSubagentMessageSource(
|
|
5
|
+
runIdValue: string | undefined,
|
|
6
|
+
agentValue: string | undefined,
|
|
7
|
+
indexValue: string | undefined,
|
|
8
|
+
): Message["source"] | undefined {
|
|
9
|
+
const subagentRunId = runIdValue?.trim();
|
|
10
|
+
if (!subagentRunId) return undefined;
|
|
11
|
+
const subagentAgent = agentValue?.trim();
|
|
12
|
+
const rawIndex = indexValue?.trim();
|
|
13
|
+
const parsedIndex = rawIndex === undefined ? undefined : Number(rawIndex);
|
|
14
|
+
const subagentIndex = parsedIndex !== undefined && Number.isInteger(parsedIndex) && parsedIndex >= 0
|
|
15
|
+
? parsedIndex : undefined;
|
|
16
|
+
return {
|
|
17
|
+
subagentRunId,
|
|
18
|
+
...(subagentAgent ? { subagentAgent } : {}),
|
|
19
|
+
...(subagentIndex !== undefined ? { subagentIndex } : {}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function readSubagentMessageSource(policy?: SubagentChildPolicy): Message["source"] | undefined {
|
|
24
|
+
const identity = policy?.intercom;
|
|
25
|
+
if (!identity) return undefined;
|
|
26
|
+
return {
|
|
27
|
+
subagentRunId: identity.runId,
|
|
28
|
+
subagentAgent: identity.agent,
|
|
29
|
+
subagentIndex: identity.index,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export interface SessionInfo {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
cwd: string;
|
|
5
|
+
model: string;
|
|
6
|
+
pid: number;
|
|
7
|
+
startedAt: number;
|
|
8
|
+
lastActivity: number;
|
|
9
|
+
status?: string;
|
|
10
|
+
/** Session's intercom group; undefined is treated as the shared "default" group. */
|
|
11
|
+
group?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Message {
|
|
15
|
+
id: string;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
replyTo?: string;
|
|
18
|
+
expectsReply?: boolean;
|
|
19
|
+
/** Actionable remote failure for a correlated ask reply. */
|
|
20
|
+
replyError?: string;
|
|
21
|
+
source?: {
|
|
22
|
+
subagentRunId: string;
|
|
23
|
+
subagentAgent?: string;
|
|
24
|
+
subagentIndex?: number;
|
|
25
|
+
};
|
|
26
|
+
content: {
|
|
27
|
+
text: string;
|
|
28
|
+
attachments?: Attachment[];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Attachment {
|
|
33
|
+
type: "file" | "snippet" | "context";
|
|
34
|
+
name: string;
|
|
35
|
+
content: string;
|
|
36
|
+
language?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Broker capability metadata binding a child registration to its supervisor. */
|
|
39
|
+
export interface SupervisorRegistration {
|
|
40
|
+
capability: string;
|
|
41
|
+
supervisorSessionId: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export type ClientMessage =
|
|
46
|
+
| {
|
|
47
|
+
type: "register";
|
|
48
|
+
session: Omit<SessionInfo, "id">;
|
|
49
|
+
/** Internal host-owned identity retained across broker reconnects. */
|
|
50
|
+
returnAddress?: string;
|
|
51
|
+
supervisor?: SupervisorRegistration;
|
|
52
|
+
supervisorOwnerToken?: string;
|
|
53
|
+
}
|
|
54
|
+
| { type: "unregister" }
|
|
55
|
+
| { type: "list"; requestId: string; group?: string }
|
|
56
|
+
| { type: "authorize_supervisor"; requestId: string; childName: string; capability?: string }
|
|
57
|
+
| { type: "send" | "supervisor_send"; to: string; message: Message; attemptId?: string }
|
|
58
|
+
| {
|
|
59
|
+
type: "send_pending_stage_notification";
|
|
60
|
+
runId: string;
|
|
61
|
+
capability: string;
|
|
62
|
+
to: string;
|
|
63
|
+
senderRegistrationName?: string;
|
|
64
|
+
senderReturnAddress?: string;
|
|
65
|
+
message: Message;
|
|
66
|
+
attemptId?: string;
|
|
67
|
+
}
|
|
68
|
+
| { type: "pending_stage_notification_result"; requestId: string; delivered: boolean }
|
|
69
|
+
| { type: "register_pending_stage_route"; runId: string; group: string; capability: string }
|
|
70
|
+
| {
|
|
71
|
+
type: "register_live_workflow_stage_route";
|
|
72
|
+
requestId: string;
|
|
73
|
+
runId: string;
|
|
74
|
+
stageKeys: string[];
|
|
75
|
+
capability: string;
|
|
76
|
+
}
|
|
77
|
+
| {
|
|
78
|
+
type: "pending_stage_message_result";
|
|
79
|
+
requestId: string;
|
|
80
|
+
outcome: "queued" | "delivered" | "forward" | "refused";
|
|
81
|
+
position?: number;
|
|
82
|
+
reason?: string;
|
|
83
|
+
reasonCode?: "message_id_conflict";
|
|
84
|
+
}
|
|
85
|
+
| { type: "presence"; name?: string; status?: string; model?: string; group?: string; requestId?: string };
|
|
86
|
+
|
|
87
|
+
export type BrokerMessage =
|
|
88
|
+
| { type: "registered"; sessionId: string; supervisorSessionId?: string }
|
|
89
|
+
| { type: "registration_failed"; reason: string }
|
|
90
|
+
| { type: "sessions"; requestId: string; sessions: SessionInfo[] }
|
|
91
|
+
| { type: "supervisor_authorized"; requestId: string; capability: string; supervisorSessionId: string; childName: string }
|
|
92
|
+
| { type: "message"; from: SessionInfo; message: Message; channel?: "supervisor" }
|
|
93
|
+
| { type: "pending_stage_notification"; requestId: string; from: SessionInfo; message: Message }
|
|
94
|
+
| {
|
|
95
|
+
type: "pending_stage_message";
|
|
96
|
+
requestId: string;
|
|
97
|
+
from: SessionInfo;
|
|
98
|
+
senderRegistrationName?: string;
|
|
99
|
+
senderReturnAddress?: string;
|
|
100
|
+
runId: string;
|
|
101
|
+
stageKey: string;
|
|
102
|
+
message: Message;
|
|
103
|
+
live?: boolean;
|
|
104
|
+
}
|
|
105
|
+
| { type: "live_workflow_stage_route_registered"; requestId: string }
|
|
106
|
+
| { type: "presence_update"; session: SessionInfo }
|
|
107
|
+
| { type: "session_joined"; session: SessionInfo }
|
|
108
|
+
| { type: "session_left"; sessionId: string }
|
|
109
|
+
| { type: "peer_disconnected"; replyTo: string; peerSessionId: string; peerName?: string }
|
|
110
|
+
| { type: "presence_ack"; requestId: string; group: string }
|
|
111
|
+
| { type: "presence_failed"; requestId: string; reason: string }
|
|
112
|
+
| { type: "error"; error: string }
|
|
113
|
+
| { type: "delivered"; messageId: string; attemptId?: string }
|
|
114
|
+
| { type: "queued"; messageId: string; attemptId?: string; runId: string; stageKey: string; position: number }
|
|
115
|
+
| { type: "delivery_failed"; messageId: string; reason: string; reasonCode?: "message_id_conflict"; attemptId?: string };
|
|
@@ -3854,10 +3854,10 @@ function hasAssistantMessage(entries) {
|
|
|
3854
3854
|
return entries.some((entry) => entry.type === "message" && entry.message.role === "assistant");
|
|
3855
3855
|
}
|
|
3856
3856
|
function persistAppendedEntry(filePath, entries, entry, flushed) {
|
|
3857
|
-
if (!hasAssistantMessage(entries))
|
|
3858
|
-
return false;
|
|
3859
3857
|
if (flushed)
|
|
3860
3858
|
appendSessionEntry(filePath, entry);
|
|
3859
|
+
else if (!hasAssistantMessage(entries))
|
|
3860
|
+
return false;
|
|
3861
3861
|
else
|
|
3862
3862
|
appendSessionEntries(filePath, entries);
|
|
3863
3863
|
return true;
|
|
@@ -9925,6 +9925,8 @@ function appendDurableDisplayCard(session, message, delivery) {
|
|
|
9925
9925
|
const card = { ...message, excludeFromContext: true };
|
|
9926
9926
|
const admitted = message;
|
|
9927
9927
|
const intentEntryId = session.sessionManager.appendCustomMessageEntry(card.customType, card.content, card.display, card.details, true, { delivery }, admitted.stageAdmissionKey);
|
|
9928
|
+
if (admitted.stageAdmissionKey !== undefined)
|
|
9929
|
+
session.sessionManager.flush();
|
|
9928
9930
|
session.agent.state.messages.push(card);
|
|
9929
9931
|
return { card, intentEntryId };
|
|
9930
9932
|
}
|
|
@@ -10150,12 +10152,17 @@ var init_agent_session_persistent_custom_messages = __esm(() => {
|
|
|
10150
10152
|
});
|
|
10151
10153
|
|
|
10152
10154
|
// src/core/agent-session-custom-message-commit.ts
|
|
10155
|
+
function appendDurableStageAdmission(session, message) {
|
|
10156
|
+
session._appendCustomMessage(message);
|
|
10157
|
+
if (message.stageAdmissionKey !== undefined)
|
|
10158
|
+
session.sessionManager?.flush();
|
|
10159
|
+
}
|
|
10153
10160
|
async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
10154
10161
|
const owner = resolveWorkflowStageDeliveryTarget(session);
|
|
10155
10162
|
if (owner !== session)
|
|
10156
10163
|
return commitAdmittedCustomMessage(owner, appMessage, options);
|
|
10157
10164
|
const self = session;
|
|
10158
|
-
const useProtectedReconciliation = options?.persistWhenStreaming === true && options.triggerTurn === true
|
|
10165
|
+
const useProtectedReconciliation = options?.persistWhenStreaming === true && options.excludeFromContext !== true && (options.triggerTurn === true || options.stageAdmissionKey !== undefined);
|
|
10159
10166
|
if (options?.deliverAs === "nextTurn") {
|
|
10160
10167
|
self._pendingNextTurnMessages.push(appMessage);
|
|
10161
10168
|
} else if (self._queuedMessagesPaused) {
|
|
@@ -10169,20 +10176,20 @@ async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
|
10169
10176
|
} else if (self.isStreaming) {
|
|
10170
10177
|
self._pendingCustomMessages.push(appMessage);
|
|
10171
10178
|
} else {
|
|
10172
|
-
self
|
|
10179
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10173
10180
|
}
|
|
10174
10181
|
} else if (options?.deliverAs === "interrupt" && options.triggerTurn) {
|
|
10175
10182
|
const interrupt = self._enqueueInterruptCustomMessage(appMessage, options);
|
|
10176
10183
|
self._workflowStageAdmission?.trackAdmittedWork(interrupt);
|
|
10177
10184
|
interrupt.catch(() => {});
|
|
10178
10185
|
} else if (self.isStreaming && options?.excludeFromContext === true && options.triggerTurn !== true && options.deliverAs === undefined) {
|
|
10179
|
-
self
|
|
10186
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10180
10187
|
} else if (self.isStreaming && options?.triggerTurn === false) {
|
|
10181
10188
|
self._pendingCustomMessages.push(appMessage);
|
|
10182
10189
|
} else if (self.isStreaming && useProtectedReconciliation) {
|
|
10183
10190
|
await queueProtectedStreamingCustomMessage(self, appMessage, options?.deliverAs === "followUp" ? "followUp" : "steer");
|
|
10184
10191
|
} else if (self.isStreaming && options?.persistWhenStreaming === true) {
|
|
10185
|
-
self
|
|
10192
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10186
10193
|
} else if (self.isStreaming && options?.triggerTurn !== false) {
|
|
10187
10194
|
self._queueAgentMessage(appMessage, options?.deliverAs === "followUp" ? "followUp" : "steer");
|
|
10188
10195
|
} else if (options?.triggerTurn) {
|
|
@@ -10205,7 +10212,7 @@ async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
|
10205
10212
|
self._continueQueuedAgentMessages().catch(() => {});
|
|
10206
10213
|
}
|
|
10207
10214
|
} else {
|
|
10208
|
-
self
|
|
10215
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10209
10216
|
}
|
|
10210
10217
|
}
|
|
10211
10218
|
function _commitAdmittedCustomMessage(appMessage, options) {
|
|
@@ -21607,11 +21614,20 @@ import {
|
|
|
21607
21614
|
function isCodexFastModeSupportedProvider(provider) {
|
|
21608
21615
|
return provider === "openai" || provider === "openai-codex";
|
|
21609
21616
|
}
|
|
21610
|
-
function
|
|
21611
|
-
return
|
|
21617
|
+
function isGitHubCopilotModel(model) {
|
|
21618
|
+
return model.provider === "github-copilot";
|
|
21612
21619
|
}
|
|
21613
|
-
function
|
|
21614
|
-
|
|
21620
|
+
function isGitHubCopilotFastModeSupportedModel(model, credential) {
|
|
21621
|
+
if (!isGitHubCopilotModel(model) || credential?.type !== "oauth")
|
|
21622
|
+
return false;
|
|
21623
|
+
const fastModelIds = credential.fastModelIds;
|
|
21624
|
+
return Array.isArray(fastModelIds) && fastModelIds.every((modelId) => typeof modelId === "string") && fastModelIds.includes(`${model.id}-fast`);
|
|
21625
|
+
}
|
|
21626
|
+
function isCodexFastModeSupportedModel(model, copilotCredential) {
|
|
21627
|
+
return isCodexFastModeSupportedProvider(model.provider) || model.api === "openai-codex-responses" || model.id !== undefined && isGitHubCopilotFastModeSupportedModel({ provider: model.provider, id: model.id }, copilotCredential);
|
|
21628
|
+
}
|
|
21629
|
+
function hasSupportedCodexFastModeModel(models, copilotCredential) {
|
|
21630
|
+
return models.some((model) => isCodexFastModeSupportedModel(model, copilotCredential));
|
|
21615
21631
|
}
|
|
21616
21632
|
function isWorkflowStageOrchestrationContext(context) {
|
|
21617
21633
|
return context?.kind === "workflow-stage";
|
|
@@ -21622,11 +21638,11 @@ function getCodexFastModeScope(context) {
|
|
|
21622
21638
|
function isCodexFastModeEnabledForScope(settings, scope) {
|
|
21623
21639
|
return settings[scope];
|
|
21624
21640
|
}
|
|
21625
|
-
function shouldApplyCodexFastModeForScope(model, settings, scope) {
|
|
21626
|
-
return isCodexFastModeSupportedModel(model) && isCodexFastModeEnabledForScope(settings, scope);
|
|
21641
|
+
function shouldApplyCodexFastModeForScope(model, settings, scope, copilotCredential) {
|
|
21642
|
+
return isCodexFastModeSupportedModel(model, copilotCredential) && isCodexFastModeEnabledForScope(settings, scope);
|
|
21627
21643
|
}
|
|
21628
|
-
function shouldApplyCodexFastMode(model, settings, context) {
|
|
21629
|
-
return shouldApplyCodexFastModeForScope(model, settings, getCodexFastModeScope(context));
|
|
21644
|
+
function shouldApplyCodexFastMode(model, settings, context, copilotCredential) {
|
|
21645
|
+
return shouldApplyCodexFastModeForScope(model, settings, getCodexFastModeScope(context), copilotCredential);
|
|
21630
21646
|
}
|
|
21631
21647
|
function formatCodexFastModeModelLabel(modelName, enabled) {
|
|
21632
21648
|
return enabled ? `${modelName} fast` : modelName;
|
|
@@ -21767,7 +21783,7 @@ class FooterComponent {
|
|
|
21767
21783
|
pwd += ` • ${sessionName}`;
|
|
21768
21784
|
const modelName = state.model?.id || "no-model";
|
|
21769
21785
|
const fastModeSettings = this.session.settingsManager.getCodexFastModeSettings();
|
|
21770
|
-
const fastModeEnabled = state.model ? shouldApplyCodexFastMode(state.model, fastModeSettings, this.session.orchestrationContext) : false;
|
|
21786
|
+
const fastModeEnabled = state.model ? shouldApplyCodexFastMode(state.model, fastModeSettings, this.session.orchestrationContext, this.session.modelRuntime.getCredentialSnapshot?.("github-copilot")) : false;
|
|
21771
21787
|
let modelLabel2 = modelName;
|
|
21772
21788
|
if (state.model?.reasoning) {
|
|
21773
21789
|
const thinkingLevel = state.thinkingLevel || "off";
|
|
@@ -39355,14 +39371,18 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
39355
39371
|
|
|
39356
39372
|
class WorkflowStageAdmissionBoundary {
|
|
39357
39373
|
open = true;
|
|
39358
|
-
completed
|
|
39374
|
+
completed;
|
|
39359
39375
|
inFlight = new Map;
|
|
39360
39376
|
pending = new Set;
|
|
39361
39377
|
invocationContext = new AsyncLocalStorage;
|
|
39362
39378
|
closePromise;
|
|
39363
39379
|
drainAdmittedWork;
|
|
39364
|
-
constructor(drainAdmittedWork =
|
|
39365
|
-
this.drainAdmittedWork = drainAdmittedWork;
|
|
39380
|
+
constructor(drainAdmittedWork = undefined, completedKeys = []) {
|
|
39381
|
+
this.drainAdmittedWork = drainAdmittedWork ?? (async () => {});
|
|
39382
|
+
this.completed = new Set(completedKeys);
|
|
39383
|
+
}
|
|
39384
|
+
static restore(entries, drainAdmittedWork) {
|
|
39385
|
+
return new WorkflowStageAdmissionBoundary(drainAdmittedWork, Array.from(entries).flatMap((entry) => entry.type === "custom_message" && typeof entry.stageAdmissionKey === "string" ? [entry.stageAdmissionKey] : []));
|
|
39366
39386
|
}
|
|
39367
39387
|
admit(key, deliver, routeLate) {
|
|
39368
39388
|
if (key !== undefined) {
|
|
@@ -39601,7 +39621,7 @@ class AgentSessionBase {
|
|
|
39601
39621
|
this._subagentPolicy = config.subagentPolicy;
|
|
39602
39622
|
this._systemPromptTransform = config.systemPromptTransform;
|
|
39603
39623
|
const stageContext = config.orchestrationContext?.kind === "workflow-stage" ? config.orchestrationContext : undefined;
|
|
39604
|
-
this._workflowStageAdmission = stageContext?.messageAdmission?.boundary ?? (stageContext ?
|
|
39624
|
+
this._workflowStageAdmission = stageContext?.messageAdmission?.boundary ?? (stageContext ? WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch()) : undefined);
|
|
39605
39625
|
if (this._workflowStageAdmission && stageContext && stageContext.messageAdmission === undefined) {
|
|
39606
39626
|
stageContext.messageAdmission = {
|
|
39607
39627
|
boundary: this._workflowStageAdmission,
|
|
@@ -46699,6 +46719,31 @@ class RemoteQueuePause {
|
|
|
46699
46719
|
var init_remote_queue_pause = () => {};
|
|
46700
46720
|
|
|
46701
46721
|
// src/modes/interactive-engine/isolated-runtime.ts
|
|
46722
|
+
import { clampThinkingLevel as clampThinkingLevel5 } from "@bastani/pi-ai/compat";
|
|
46723
|
+
function applyPersistedModelDefault(session, model, alreadyInScope) {
|
|
46724
|
+
session.settingsManager.setDefaultModelAndProvider(model.provider, model.id);
|
|
46725
|
+
if (alreadyInScope || session.scopedModels.length === 0)
|
|
46726
|
+
return;
|
|
46727
|
+
const enabledModels = session.settingsManager.getEnabledModels();
|
|
46728
|
+
if (!enabledModels?.length)
|
|
46729
|
+
return;
|
|
46730
|
+
const modelReference = `${model.provider}/${model.id}`;
|
|
46731
|
+
if (enabledModels.some((pattern) => pattern.toLowerCase() === modelReference.toLowerCase()))
|
|
46732
|
+
return;
|
|
46733
|
+
session.settingsManager.setEnabledModels([...enabledModels, modelReference]);
|
|
46734
|
+
}
|
|
46735
|
+
function thinkingPersistTarget(result) {
|
|
46736
|
+
if (!result.provider || !result.modelId)
|
|
46737
|
+
return;
|
|
46738
|
+
return { provider: result.provider, modelId: result.modelId };
|
|
46739
|
+
}
|
|
46740
|
+
function applyPersistedThinkingDefault(session, level, target) {
|
|
46741
|
+
if (target) {
|
|
46742
|
+
session.settingsManager.setModelThinkingLevel(target.provider, target.modelId, level);
|
|
46743
|
+
return;
|
|
46744
|
+
}
|
|
46745
|
+
session.settingsManager.setDefaultThinkingLevel(level);
|
|
46746
|
+
}
|
|
46702
46747
|
var IsolatedInteractiveRuntime;
|
|
46703
46748
|
var init_isolated_runtime = __esm(() => {
|
|
46704
46749
|
init_agent_session_runtime();
|
|
@@ -46717,6 +46762,7 @@ var init_isolated_runtime = __esm(() => {
|
|
|
46717
46762
|
steeringMessages = [];
|
|
46718
46763
|
followUpMessages = [];
|
|
46719
46764
|
queueUpdateGeneration = 0;
|
|
46765
|
+
thinkingEpoch = 0;
|
|
46720
46766
|
pendingQueueClear;
|
|
46721
46767
|
engineCallbackActive = false;
|
|
46722
46768
|
queuePause;
|
|
@@ -47081,43 +47127,56 @@ var init_isolated_runtime = __esm(() => {
|
|
|
47081
47127
|
},
|
|
47082
47128
|
setModel: {
|
|
47083
47129
|
configurable: true,
|
|
47084
|
-
value: async (model) => {
|
|
47085
|
-
const selected = await this.client.setModel(model.provider, model.id);
|
|
47086
|
-
|
|
47130
|
+
value: async (model, options) => {
|
|
47131
|
+
const selected = await this.client.setModel(model.provider, model.id, options);
|
|
47132
|
+
const nextModel = session.modelRuntime.getModel(selected.provider, selected.id) ?? model;
|
|
47133
|
+
session.agent.state.model = nextModel;
|
|
47087
47134
|
this.resolveModelFallback();
|
|
47135
|
+
if (options?.persist === true)
|
|
47136
|
+
await this.syncPersistedModelCatalog(session, nextModel);
|
|
47088
47137
|
}
|
|
47089
47138
|
},
|
|
47090
47139
|
setThinkingLevel: {
|
|
47091
47140
|
configurable: true,
|
|
47092
|
-
value: (level) => {
|
|
47093
|
-
|
|
47094
|
-
|
|
47141
|
+
value: (level, options) => {
|
|
47142
|
+
const availableLevels = session.getAvailableThinkingLevels();
|
|
47143
|
+
const effectiveLevel = availableLevels.includes(level) ? level : session.model ? clampThinkingLevel5(session.model, level) : "off";
|
|
47144
|
+
session.agent.state.thinkingLevel = effectiveLevel;
|
|
47145
|
+
const epoch = ++this.thinkingEpoch;
|
|
47146
|
+
this.dispatchBestEffort("set thinking level", this.client.setThinkingLevelAck(level, options).then((result) => {
|
|
47147
|
+
this.applyThinkingAck(session, epoch, result, options?.persist === true);
|
|
47148
|
+
}));
|
|
47095
47149
|
}
|
|
47096
47150
|
},
|
|
47097
47151
|
cycleModel: {
|
|
47098
47152
|
configurable: true,
|
|
47099
|
-
value: async (direction) => {
|
|
47153
|
+
value: async (direction, options) => {
|
|
47100
47154
|
const previousModel = session.model;
|
|
47101
|
-
const result = await this.client.cycleModel(direction);
|
|
47155
|
+
const result = await this.client.cycleModel(direction, options);
|
|
47102
47156
|
if (!result)
|
|
47103
47157
|
return;
|
|
47104
47158
|
const model = session.modelRuntime.getModel(result.model.provider, result.model.id) ?? result.model;
|
|
47105
47159
|
session.agent.state.model = model;
|
|
47106
47160
|
session.agent.state.thinkingLevel = result.thinkingLevel;
|
|
47107
47161
|
this.resolveModelFallbackAfterExplicitModelSelection(previousModel, model);
|
|
47162
|
+
if (options?.persist === true)
|
|
47163
|
+
await this.syncPersistedModelCatalog(session, model);
|
|
47108
47164
|
return { ...result, model };
|
|
47109
47165
|
}
|
|
47110
47166
|
},
|
|
47111
47167
|
cycleThinkingLevel: {
|
|
47112
47168
|
configurable: true,
|
|
47113
|
-
value: () => {
|
|
47169
|
+
value: (options) => {
|
|
47114
47170
|
const levels = session.getAvailableThinkingLevels();
|
|
47115
47171
|
if (levels.length <= 1)
|
|
47116
47172
|
return;
|
|
47117
47173
|
const current = levels.indexOf(session.thinkingLevel);
|
|
47118
47174
|
const level = levels[(current + 1) % levels.length];
|
|
47119
47175
|
session.agent.state.thinkingLevel = level;
|
|
47120
|
-
|
|
47176
|
+
const epoch = ++this.thinkingEpoch;
|
|
47177
|
+
this.dispatchBestEffort("cycle thinking level", this.client.setThinkingLevelAck(level, options).then((result) => {
|
|
47178
|
+
this.applyThinkingAck(session, epoch, result, options?.persist === true);
|
|
47179
|
+
}));
|
|
47121
47180
|
return level;
|
|
47122
47181
|
}
|
|
47123
47182
|
},
|
|
@@ -47161,6 +47220,14 @@ var init_isolated_runtime = __esm(() => {
|
|
|
47161
47220
|
this.engineCallbackActive = false;
|
|
47162
47221
|
}
|
|
47163
47222
|
}
|
|
47223
|
+
applyThinkingAck(session, epoch, result, persist) {
|
|
47224
|
+
if (persist) {
|
|
47225
|
+
applyPersistedThinkingDefault(session, result.level, thinkingPersistTarget(result));
|
|
47226
|
+
}
|
|
47227
|
+
if (epoch === this.thinkingEpoch) {
|
|
47228
|
+
session.agent.state.thinkingLevel = result.level;
|
|
47229
|
+
}
|
|
47230
|
+
}
|
|
47164
47231
|
dispatchBestEffort(label, operation) {
|
|
47165
47232
|
operation.catch((error) => {
|
|
47166
47233
|
if (this.health.isRecovering())
|
|
@@ -47201,6 +47268,12 @@ var init_isolated_runtime = __esm(() => {
|
|
|
47201
47268
|
}
|
|
47202
47269
|
});
|
|
47203
47270
|
}
|
|
47271
|
+
async syncPersistedModelCatalog(session, model) {
|
|
47272
|
+
const alreadyInScope = session.scopedModels.some((scoped) => scoped.model.provider === model.provider && scoped.model.id === model.id);
|
|
47273
|
+
const catalog = await this.client.requestInternal({ type: "get_available_models" });
|
|
47274
|
+
this.remoteModelCatalog.apply(catalog);
|
|
47275
|
+
applyPersistedModelDefault(session, model, alreadyInScope);
|
|
47276
|
+
}
|
|
47204
47277
|
refreshSessionView() {
|
|
47205
47278
|
const session = super.session;
|
|
47206
47279
|
const sessionFile = session.sessionFile;
|
|
@@ -47240,6 +47313,7 @@ var init_isolated_runtime = __esm(() => {
|
|
|
47240
47313
|
session.agent.state.model = event.model;
|
|
47241
47314
|
break;
|
|
47242
47315
|
case "thinking_level_changed":
|
|
47316
|
+
this.thinkingEpoch += 1;
|
|
47243
47317
|
session.agent.state.thinkingLevel = event.level;
|
|
47244
47318
|
break;
|
|
47245
47319
|
case "session_info_changed":
|
|
@@ -48453,7 +48527,7 @@ var init_slash_commands = __esm(() => {
|
|
|
48453
48527
|
{ name: "tree", description: "Navigate session tree (switch branches)" },
|
|
48454
48528
|
{ name: "thinking", description: "Set thinking level", argumentHint: "<level>" },
|
|
48455
48529
|
{ name: "scoped-models", description: "Enable/disable models for ctrl+p cycling" },
|
|
48456
|
-
{ name: "fast", description: "Configure
|
|
48530
|
+
{ name: "fast", description: "Configure OpenAI fast mode for chat and workflows in supported models" },
|
|
48457
48531
|
{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },
|
|
48458
48532
|
{ name: "import", description: "Import and resume a session from a JSONL file" },
|
|
48459
48533
|
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
@@ -49905,7 +49979,7 @@ var init_interactive_autocomplete = __esm(() => {
|
|
|
49905
49979
|
return [...this.session.modelRuntime.getAvailableSnapshot()];
|
|
49906
49980
|
};
|
|
49907
49981
|
InteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function() {
|
|
49908
|
-
return hasSupportedCodexFastModeModel(this.getCodexFastModeCandidateModels());
|
|
49982
|
+
return hasSupportedCodexFastModeModel(this.getCodexFastModeCandidateModels(), this.session.modelRuntime.getCredentialSnapshot?.("github-copilot"));
|
|
49909
49983
|
};
|
|
49910
49984
|
InteractiveModeBase.prototype.buildRemoteSlashCommands = function(localCommands) {
|
|
49911
49985
|
const remote = getInteractiveEngineRemoteCommands(this.runtimeHost);
|
|
@@ -50593,7 +50667,7 @@ var init_interactive_startup = __esm(() => {
|
|
|
50593
50667
|
if (!model) {
|
|
50594
50668
|
return modelLabel2;
|
|
50595
50669
|
}
|
|
50596
|
-
const fastModeEnabled = shouldApplyCodexFastMode(model, this.session.settingsManager.getCodexFastModeSettings(), this.session.orchestrationContext);
|
|
50670
|
+
const fastModeEnabled = shouldApplyCodexFastMode(model, this.session.settingsManager.getCodexFastModeSettings(), this.session.orchestrationContext, this.session.modelRuntime.getCredentialSnapshot?.("github-copilot"));
|
|
50597
50671
|
return formatCodexFastModeModelLabel(modelLabel2, fastModeEnabled);
|
|
50598
50672
|
};
|
|
50599
50673
|
InteractiveModeBase.prototype.getStartupIdentityText = function(maxWidth, gap = 0, manifestoPhase = 4) {
|
|
@@ -55108,7 +55182,7 @@ var init_interactive_selectors = __esm(() => {
|
|
|
55108
55182
|
});
|
|
55109
55183
|
|
|
55110
55184
|
// src/modes/interactive/interactive-model-routing.ts
|
|
55111
|
-
import { clampThinkingLevel as
|
|
55185
|
+
import { clampThinkingLevel as clampThinkingLevel6 } from "@bastani/pi-ai/compat";
|
|
55112
55186
|
function resolveThinkingSelectorDefault(rawDefault, availableLevels, model) {
|
|
55113
55187
|
if (rawDefault === undefined)
|
|
55114
55188
|
return;
|
|
@@ -55116,7 +55190,7 @@ function resolveThinkingSelectorDefault(rawDefault, availableLevels, model) {
|
|
|
55116
55190
|
return rawDefault;
|
|
55117
55191
|
if (!model)
|
|
55118
55192
|
return availableLevels.includes("off") ? "off" : availableLevels[0];
|
|
55119
|
-
const clamped =
|
|
55193
|
+
const clamped = clampThinkingLevel6(model, rawDefault);
|
|
55120
55194
|
if (availableLevels.includes(clamped))
|
|
55121
55195
|
return clamped;
|
|
55122
55196
|
return availableLevels.includes("off") ? "off" : availableLevels[0];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/mcp",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension that adapts MCP (Model Context Protocol) servers into the coding agent. Fork of: https://github.com/nicobailon/pi-mcp-adapter",
|
|
6
6
|
"contributors": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/subagents",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
|
|
6
6
|
"contributors": [
|