@kortix/sdk 0.13.28 → 0.13.30
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/core/client/kortix.d.ts +4 -0
- package/dist/core/client/kortix.d.ts.map +1 -1
- package/dist/core/client/kortix.js +32 -1
- package/dist/core/client/kortix.js.map +1 -1
- package/dist/core/http/api-client.js.map +1 -1
- package/dist/core/rest/projects-client/accounts.d.ts +5 -0
- package/dist/core/rest/projects-client/accounts.d.ts.map +1 -1
- package/dist/core/rest/projects-client/accounts.js.map +1 -1
- package/dist/core/rest/projects-client/agent-config.d.ts +8 -0
- package/dist/core/rest/projects-client/agent-config.d.ts.map +1 -1
- package/dist/core/rest/projects-client/agent-config.js.map +1 -1
- package/dist/core/rest/projects-client/apps.d.ts +14 -0
- package/dist/core/rest/projects-client/apps.d.ts.map +1 -1
- package/dist/core/rest/projects-client/apps.js +4 -0
- package/dist/core/rest/projects-client/apps.js.map +1 -1
- package/dist/core/rest/projects-client/audit.d.ts +4 -0
- package/dist/core/rest/projects-client/audit.d.ts.map +1 -1
- package/dist/core/rest/projects-client/audit.js.map +1 -1
- package/dist/core/rest/projects-client/gateway.d.ts +4 -8
- package/dist/core/rest/projects-client/gateway.d.ts.map +1 -1
- package/dist/core/rest/projects-client/gateway.js.map +1 -1
- package/dist/core/rest/projects-client/iam.d.ts +16 -0
- package/dist/core/rest/projects-client/iam.d.ts.map +1 -1
- package/dist/core/rest/projects-client/iam.js +7 -0
- package/dist/core/rest/projects-client/iam.js.map +1 -1
- package/dist/core/rest/projects-client/index.d.ts +1 -0
- package/dist/core/rest/projects-client/index.d.ts.map +1 -1
- package/dist/core/rest/projects-client/index.js +1 -0
- package/dist/core/rest/projects-client/index.js.map +1 -1
- package/dist/core/rest/projects-client/projects.d.ts +15 -1
- package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
- package/dist/core/rest/projects-client/projects.js +1 -0
- package/dist/core/rest/projects-client/projects.js.map +1 -1
- package/dist/core/rest/projects-client/review-items.d.ts +173 -0
- package/dist/core/rest/projects-client/review-items.d.ts.map +1 -0
- package/dist/core/rest/projects-client/review-items.js +260 -0
- package/dist/core/rest/projects-client/review-items.js.map +1 -0
- package/dist/core/rest/projects-client/session-costs.d.ts +7 -9
- package/dist/core/rest/projects-client/session-costs.d.ts.map +1 -1
- package/dist/core/rest/projects-client/session-costs.js.map +1 -1
- package/dist/core/turns/index.d.ts +3 -0
- package/dist/core/turns/index.d.ts.map +1 -1
- package/dist/core/turns/index.js +2 -0
- package/dist/core/turns/index.js.map +1 -1
- package/dist/core/turns/segments/burst-summary.d.ts +49 -0
- package/dist/core/turns/segments/burst-summary.d.ts.map +1 -0
- package/dist/core/turns/segments/burst-summary.js +64 -0
- package/dist/core/turns/segments/burst-summary.js.map +1 -0
- package/dist/core/turns/segments/compaction-state.d.ts +44 -0
- package/dist/core/turns/segments/compaction-state.d.ts.map +1 -0
- package/dist/core/turns/segments/compaction-state.js +79 -0
- package/dist/core/turns/segments/compaction-state.js.map +1 -0
- package/dist/core/turns/segments/group-steps.d.ts +22 -0
- package/dist/core/turns/segments/group-steps.d.ts.map +1 -0
- package/dist/core/turns/segments/group-steps.js +89 -0
- package/dist/core/turns/segments/group-steps.js.map +1 -0
- package/dist/core/turns/segments/index.d.ts +21 -0
- package/dist/core/turns/segments/index.d.ts.map +1 -0
- package/dist/core/turns/segments/index.js +21 -0
- package/dist/core/turns/segments/index.js.map +1 -0
- package/dist/core/turns/segments/merge-steps.d.ts +79 -0
- package/dist/core/turns/segments/merge-steps.d.ts.map +1 -0
- package/dist/core/turns/segments/merge-steps.js +190 -0
- package/dist/core/turns/segments/merge-steps.js.map +1 -0
- package/dist/core/turns/segments/message-time.d.ts +86 -0
- package/dist/core/turns/segments/message-time.d.ts.map +1 -0
- package/dist/core/turns/segments/message-time.js +196 -0
- package/dist/core/turns/segments/message-time.js.map +1 -0
- package/dist/core/turns/segments/narration.d.ts +71 -0
- package/dist/core/turns/segments/narration.d.ts.map +1 -0
- package/dist/core/turns/segments/narration.js +836 -0
- package/dist/core/turns/segments/narration.js.map +1 -0
- package/dist/core/turns/segments/segment-turn.d.ts +26 -0
- package/dist/core/turns/segments/segment-turn.d.ts.map +1 -0
- package/dist/core/turns/segments/segment-turn.js +36 -0
- package/dist/core/turns/segments/segment-turn.js.map +1 -0
- package/dist/core/turns/segments/session-activity-groups.d.ts +93 -0
- package/dist/core/turns/segments/session-activity-groups.d.ts.map +1 -0
- package/dist/core/turns/segments/session-activity-groups.js +127 -0
- package/dist/core/turns/segments/session-activity-groups.js.map +1 -0
- package/dist/core/turns/segments/step-label.d.ts +44 -0
- package/dist/core/turns/segments/step-label.d.ts.map +1 -0
- package/dist/core/turns/segments/step-label.js +129 -0
- package/dist/core/turns/segments/step-label.js.map +1 -0
- package/dist/core/turns/segments/turn-busy-visibility.d.ts +51 -0
- package/dist/core/turns/segments/turn-busy-visibility.d.ts.map +1 -0
- package/dist/core/turns/segments/turn-busy-visibility.js +47 -0
- package/dist/core/turns/segments/turn-busy-visibility.js.map +1 -0
- package/dist/core/turns/segments/working-turn.d.ts +165 -0
- package/dist/core/turns/segments/working-turn.d.ts.map +1 -0
- package/dist/core/turns/segments/working-turn.js +168 -0
- package/dist/core/turns/segments/working-turn.js.map +1 -0
- package/dist/core/turns/text-scan.d.ts +65 -0
- package/dist/core/turns/text-scan.d.ts.map +1 -0
- package/dist/core/turns/text-scan.js +344 -0
- package/dist/core/turns/text-scan.js.map +1 -0
- package/dist/core/turns/tools/agent-helpers.d.ts +10 -0
- package/dist/core/turns/tools/agent-helpers.d.ts.map +1 -0
- package/dist/core/turns/tools/agent-helpers.js +54 -0
- package/dist/core/turns/tools/agent-helpers.js.map +1 -0
- package/dist/core/turns/tools/file-verb.d.ts +81 -0
- package/dist/core/turns/tools/file-verb.d.ts.map +1 -0
- package/dist/core/turns/tools/file-verb.js +70 -0
- package/dist/core/turns/tools/file-verb.js.map +1 -0
- package/dist/core/turns/tools/index.d.ts +22 -0
- package/dist/core/turns/tools/index.d.ts.map +1 -0
- package/dist/core/turns/tools/index.js +22 -0
- package/dist/core/turns/tools/index.js.map +1 -0
- package/dist/core/turns/tools/memory-helpers.d.ts +16 -0
- package/dist/core/turns/tools/memory-helpers.d.ts.map +1 -0
- package/dist/core/turns/tools/memory-helpers.js +55 -0
- package/dist/core/turns/tools/memory-helpers.js.map +1 -0
- package/dist/core/turns/tools/patch-summary.d.ts +53 -0
- package/dist/core/turns/tools/patch-summary.d.ts.map +1 -0
- package/dist/core/turns/tools/patch-summary.js +71 -0
- package/dist/core/turns/tools/patch-summary.js.map +1 -0
- package/dist/core/turns/tools/presentation-helpers.d.ts +16 -0
- package/dist/core/turns/tools/presentation-helpers.d.ts.map +1 -0
- package/dist/core/turns/tools/presentation-helpers.js +18 -0
- package/dist/core/turns/tools/presentation-helpers.js.map +1 -0
- package/dist/core/turns/tools/question-helpers.d.ts +10 -0
- package/dist/core/turns/tools/question-helpers.d.ts.map +1 -0
- package/dist/core/turns/tools/question-helpers.js +13 -0
- package/dist/core/turns/tools/question-helpers.js.map +1 -0
- package/dist/core/turns/tools/read-helpers.d.ts +8 -0
- package/dist/core/turns/tools/read-helpers.d.ts.map +1 -0
- package/dist/core/turns/tools/read-helpers.js +25 -0
- package/dist/core/turns/tools/read-helpers.js.map +1 -0
- package/dist/core/turns/tools/search-query.d.ts +28 -0
- package/dist/core/turns/tools/search-query.d.ts.map +1 -0
- package/dist/core/turns/tools/search-query.js +137 -0
- package/dist/core/turns/tools/search-query.js.map +1 -0
- package/dist/core/turns/tools/show-availability.d.ts +53 -0
- package/dist/core/turns/tools/show-availability.d.ts.map +1 -0
- package/dist/core/turns/tools/show-availability.js +110 -0
- package/dist/core/turns/tools/show-availability.js.map +1 -0
- package/dist/core/turns/tools/skill-helpers.d.ts +35 -0
- package/dist/core/turns/tools/skill-helpers.d.ts.map +1 -0
- package/dist/core/turns/tools/skill-helpers.js +129 -0
- package/dist/core/turns/tools/skill-helpers.js.map +1 -0
- package/dist/core/turns/tools/tool-meta.d.ts +72 -0
- package/dist/core/turns/tools/tool-meta.d.ts.map +1 -0
- package/dist/core/turns/tools/tool-meta.js +174 -0
- package/dist/core/turns/tools/tool-meta.js.map +1 -0
- package/dist/core/turns/tools/tool-outcome.d.ts +78 -0
- package/dist/core/turns/tools/tool-outcome.d.ts.map +1 -0
- package/dist/core/turns/tools/tool-outcome.js +244 -0
- package/dist/core/turns/tools/tool-outcome.js.map +1 -0
- package/dist/core/turns/tools/tool-output-format.d.ts +63 -0
- package/dist/core/turns/tools/tool-output-format.d.ts.map +1 -0
- package/dist/core/turns/tools/tool-output-format.js +174 -0
- package/dist/core/turns/tools/tool-output-format.js.map +1 -0
- package/dist/core/turns/tools/web-helpers.d.ts +40 -0
- package/dist/core/turns/tools/web-helpers.d.ts.map +1 -0
- package/dist/core/turns/tools/web-helpers.js +297 -0
- package/dist/core/turns/tools/web-helpers.js.map +1 -0
- package/dist/kortix.esm.min.js +42 -26
- package/dist/kortix.global.js +42 -26
- package/dist/react/session-cache-write.d.ts +3 -3
- package/dist/react/session-cache-write.d.ts.map +1 -1
- package/dist/react/session-cache-write.js +31 -5
- package/dist/react/session-cache-write.js.map +1 -1
- package/dist/react/sign-in-with-kortix.d.ts +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A burst's parts → how much work it holds, and the one line that says so.
|
|
3
|
+
*
|
|
4
|
+
* The collapsed row is the door to a list of N steps, so it names N. It used to
|
|
5
|
+
* name a reasoning heading instead (`burstTitle`), which told the reader nothing
|
|
6
|
+
* about size and put model-authored prose in a slot we do not control.
|
|
7
|
+
*
|
|
8
|
+
* `total` MUST equal the number of units the expanded chain renders, so the
|
|
9
|
+
* counting rules here mirror `mergeBurstSteps` exactly: plumbing never counts
|
|
10
|
+
* and never breaks a run around it, and a run of consecutive reasoning fragments
|
|
11
|
+
* is ONE unit because it renders as one Thinking row.
|
|
12
|
+
*
|
|
13
|
+
* Two places deliberately part company with the rendered row count, and both
|
|
14
|
+
* are the same trade: the reader's unit of "step" is CALLS MADE, because
|
|
15
|
+
* `failed` counts individual tool parts and any other unit would make
|
|
16
|
+
* `Completed 10 of 11 steps` arithmetic nonsense.
|
|
17
|
+
*
|
|
18
|
+
* 1. A group row holding 5 reads counts 5, not 1.
|
|
19
|
+
* 2. A file-chip row dedupes by path (`activity-file-chips.tsx`), so three
|
|
20
|
+
* reads of one file open to ONE chip while `total` still says 3. Counting
|
|
21
|
+
* the chips instead would under-report a run that really did read the file
|
|
22
|
+
* three times, and would make `failed` — which cannot dedupe, since two
|
|
23
|
+
* failures on one path are two failures — the odd unit out.
|
|
24
|
+
*
|
|
25
|
+
* Both are pinned by tests: see `burst-summary.test.ts` ("three reads of one
|
|
26
|
+
* path") and `activity-file-chips.test.tsx`.
|
|
27
|
+
*
|
|
28
|
+
* No React import. `partOutcome` is taken from `tool/shared/tool-outcome`, not
|
|
29
|
+
* from the `infrastructure` barrel that re-exports it, so this module stays
|
|
30
|
+
* testable without loading 1500 lines of JSX.
|
|
31
|
+
*/
|
|
32
|
+
import type { Part } from '../../runtime/client.js';
|
|
33
|
+
export interface BurstSummary {
|
|
34
|
+
/** Every row-worthy unit in this burst. */
|
|
35
|
+
total: number;
|
|
36
|
+
/** Tool calls whose outcome is not `ok`. */
|
|
37
|
+
failed: number;
|
|
38
|
+
/** `total - failed`. */
|
|
39
|
+
completed: number;
|
|
40
|
+
/**
|
|
41
|
+
* Whether any part was plumbing. The label needs it to tell the two empty
|
|
42
|
+
* bursts apart — machinery that ran and was hidden ("Housekeeping") versus
|
|
43
|
+
* nothing at all ("Worked") — and it cannot see `parts` to work that out.
|
|
44
|
+
*/
|
|
45
|
+
hasPlumbing: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare function burstSummary(parts: ReadonlyArray<Part>): BurstSummary;
|
|
48
|
+
export declare function burstSummaryLabel(summary: BurstSummary, running: boolean): string;
|
|
49
|
+
//# sourceMappingURL=burst-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"burst-summary.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/segments/burst-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAKjD,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,YAAY,CAuCrE;AAMD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAiBjF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { isReasoningPart, isToolPart } from '../parts.js';
|
|
2
|
+
import { partOutcome } from '../tools/tool-outcome.js';
|
|
3
|
+
import { stepLabel } from './step-label.js';
|
|
4
|
+
export function burstSummary(parts) {
|
|
5
|
+
let total = 0;
|
|
6
|
+
let failed = 0;
|
|
7
|
+
let hasPlumbing = false;
|
|
8
|
+
// Open while the previous counted part was reasoning, so consecutive
|
|
9
|
+
// fragments extend one run instead of opening a second.
|
|
10
|
+
let inThought = false;
|
|
11
|
+
for (const part of parts) {
|
|
12
|
+
if (stepLabel(part).tier === 'plumbing') {
|
|
13
|
+
hasPlumbing = true;
|
|
14
|
+
// No `inThought = false` here, on purpose: a memory write between two
|
|
15
|
+
// thoughts renders no row, so it must not split them into two.
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (isReasoningPart(part)) {
|
|
19
|
+
// An empty fragment renders nothing, so it neither counts nor closes the
|
|
20
|
+
// run it sits inside — same read-before-flush order as `mergeBurstSteps`.
|
|
21
|
+
const text = part.text?.trim();
|
|
22
|
+
if (!text)
|
|
23
|
+
continue;
|
|
24
|
+
if (!inThought) {
|
|
25
|
+
inThought = true;
|
|
26
|
+
total += 1;
|
|
27
|
+
}
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
inThought = false;
|
|
31
|
+
total += 1;
|
|
32
|
+
// Identical predicate to the old `burstFailureCount`: tool parts only —
|
|
33
|
+
// a thought has no verdict to report — and plumbing is already skipped
|
|
34
|
+
// above, which is load-bearing. A failed compaction call renders no row,
|
|
35
|
+
// so counting it would close the chain on a failure the reader cannot find.
|
|
36
|
+
if (isToolPart(part) && partOutcome(part) !== 'ok')
|
|
37
|
+
failed += 1;
|
|
38
|
+
}
|
|
39
|
+
return { total, failed, completed: total - failed, hasPlumbing };
|
|
40
|
+
}
|
|
41
|
+
function steps(count) {
|
|
42
|
+
return `${count} ${count === 1 ? 'step' : 'steps'}`;
|
|
43
|
+
}
|
|
44
|
+
export function burstSummaryLabel(summary, running) {
|
|
45
|
+
const { total, failed, completed, hasPlumbing } = summary;
|
|
46
|
+
// A running burst reports no failures. Its calls are still landing, so any
|
|
47
|
+
// count would be a snapshot the next frame contradicts. One rule, one place —
|
|
48
|
+
// callers pass the summary through unchanged.
|
|
49
|
+
if (running)
|
|
50
|
+
return total === 0 ? 'Working' : `Working · ${steps(total)}`;
|
|
51
|
+
if (total === 0)
|
|
52
|
+
return hasPlumbing ? 'Housekeeping' : 'Worked';
|
|
53
|
+
if (failed === 0)
|
|
54
|
+
return `Completed ${steps(total)}`;
|
|
55
|
+
// Nothing completed, so nothing claims to have. "Completed 0 of 2" is a
|
|
56
|
+
// sentence that leads with a success that did not happen.
|
|
57
|
+
if (completed === 0)
|
|
58
|
+
return `${steps(total)} failed`;
|
|
59
|
+
// `10 of 11` alone makes the reader subtract. The clause costs eight
|
|
60
|
+
// characters, states the fact, and carries no adjective — not "error",
|
|
61
|
+
// not "problem".
|
|
62
|
+
return `Completed ${completed} of ${total} steps · ${failed} failed`;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=burst-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"burst-summary.js","sourceRoot":"","sources":["../../../../src/core/turns/segments/burst-summary.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAiBzC,MAAM,UAAU,YAAY,CAAC,KAA0B;IACrD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,qEAAqE;IACrE,wDAAwD;IACxD,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACxC,WAAW,GAAG,IAAI,CAAC;YACnB,sEAAsE;YACtE,+DAA+D;YAC/D,SAAS;QACX,CAAC;QAED,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,yEAAyE;YACzE,0EAA0E;YAC1E,MAAM,IAAI,GAAI,IAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YACtD,IAAI,CAAC,IAAI;gBAAE,SAAS;YACpB,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,SAAS,GAAG,IAAI,CAAC;gBACjB,KAAK,IAAI,CAAC,CAAC;YACb,CAAC;YACD,SAAS;QACX,CAAC;QAED,SAAS,GAAG,KAAK,CAAC;QAClB,KAAK,IAAI,CAAC,CAAC;QAEX,wEAAwE;QACxE,uEAAuE;QACvE,yEAAyE;QACzE,4EAA4E;Q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that can fail (the component
|
|
4
|
+
* around them needs a DOM and this repo's `bun test` has none).
|
|
5
|
+
*
|
|
6
|
+
* A turn is a COMPACTION turn when a summary message is present. Usually that
|
|
7
|
+
* is an assistant message carrying the runtime's `summary: true` flag — but a
|
|
8
|
+
* summary message with NO user prompt to attach to becomes a SYNTHETIC turn
|
|
9
|
+
* (`groupMessagesIntoTurns`): the summary message IS `turn.userMessage` and
|
|
10
|
+
* `assistantMessages` is empty. Scanning only `assistantMessages` missed
|
|
11
|
+
* those, so each failed attempt rendered as an EMPTY normal turn — a 0px
|
|
12
|
+
* TurnViewport whose `contain-intrinsic-size: auto 600px` ballooned to a
|
|
13
|
+
* 600px blank block whenever `content-visibility` skipped it.
|
|
14
|
+
*
|
|
15
|
+
* It HAS CONTENT when a `compaction` part exists or a summary message has
|
|
16
|
+
* non-whitespace text. `inFlight` means a summary message is neither
|
|
17
|
+
* completed nor errored — the message-state half of "is this running", which
|
|
18
|
+
* the working projection cannot see (compaction "is not a turn" to it).
|
|
19
|
+
* `error` is the first summary message's raw error, needed because
|
|
20
|
+
* `getTurnError` also reads only `assistantMessages` and so reports nothing
|
|
21
|
+
* for a synthetic turn.
|
|
22
|
+
*/
|
|
23
|
+
export interface CompactionTurnInfo {
|
|
24
|
+
isCompaction: boolean;
|
|
25
|
+
hasContent: boolean;
|
|
26
|
+
inFlight: boolean;
|
|
27
|
+
/** Raw `info.error` of the first errored summary message, else null. */
|
|
28
|
+
error: unknown;
|
|
29
|
+
}
|
|
30
|
+
interface MessageLike {
|
|
31
|
+
info: unknown;
|
|
32
|
+
parts?: ReadonlyArray<{
|
|
33
|
+
type: string;
|
|
34
|
+
text?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/** Minimal structural shape — the SDK turn types satisfy it. */
|
|
38
|
+
interface CompactionTurnLike {
|
|
39
|
+
userMessage?: MessageLike;
|
|
40
|
+
assistantMessages: ReadonlyArray<MessageLike>;
|
|
41
|
+
}
|
|
42
|
+
export declare function compactionTurnInfo(turn: CompactionTurnLike): CompactionTurnInfo;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=compaction-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction-state.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/segments/compaction-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxD;AAED,gEAAgE;AAChE,UAAU,kBAAkB;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CAC/C;AAQD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CAuD/E"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a compaction turn amounts to — pure, so the marker/failed-row
|
|
3
|
+
* decisions in session-chat.tsx have a test that can fail (the component
|
|
4
|
+
* around them needs a DOM and this repo's `bun test` has none).
|
|
5
|
+
*
|
|
6
|
+
* A turn is a COMPACTION turn when a summary message is present. Usually that
|
|
7
|
+
* is an assistant message carrying the runtime's `summary: true` flag — but a
|
|
8
|
+
* summary message with NO user prompt to attach to becomes a SYNTHETIC turn
|
|
9
|
+
* (`groupMessagesIntoTurns`): the summary message IS `turn.userMessage` and
|
|
10
|
+
* `assistantMessages` is empty. Scanning only `assistantMessages` missed
|
|
11
|
+
* those, so each failed attempt rendered as an EMPTY normal turn — a 0px
|
|
12
|
+
* TurnViewport whose `contain-intrinsic-size: auto 600px` ballooned to a
|
|
13
|
+
* 600px blank block whenever `content-visibility` skipped it.
|
|
14
|
+
*
|
|
15
|
+
* It HAS CONTENT when a `compaction` part exists or a summary message has
|
|
16
|
+
* non-whitespace text. `inFlight` means a summary message is neither
|
|
17
|
+
* completed nor errored — the message-state half of "is this running", which
|
|
18
|
+
* the working projection cannot see (compaction "is not a turn" to it).
|
|
19
|
+
* `error` is the first summary message's raw error, needed because
|
|
20
|
+
* `getTurnError` also reads only `assistantMessages` and so reports nothing
|
|
21
|
+
* for a synthetic turn.
|
|
22
|
+
*/
|
|
23
|
+
export function compactionTurnInfo(turn) {
|
|
24
|
+
let isCompaction = false;
|
|
25
|
+
let hasContent = false;
|
|
26
|
+
let inFlight = false;
|
|
27
|
+
let error = null;
|
|
28
|
+
const scanSummaryInfo = (raw) => {
|
|
29
|
+
const info = raw;
|
|
30
|
+
if (info?.summary !== true)
|
|
31
|
+
return false;
|
|
32
|
+
isCompaction = true;
|
|
33
|
+
if (!info.time?.completed && !info.error)
|
|
34
|
+
inFlight = true;
|
|
35
|
+
if (error == null && info.error != null)
|
|
36
|
+
error = info.error;
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
const scanParts = (parts) => {
|
|
40
|
+
for (const part of parts ?? []) {
|
|
41
|
+
if (part.type === 'compaction') {
|
|
42
|
+
isCompaction = true;
|
|
43
|
+
hasContent = true;
|
|
44
|
+
}
|
|
45
|
+
else if (part.type === 'text' && part.text?.trim()) {
|
|
46
|
+
hasContent = true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
// The REQUEST marker: opencode's `SessionCompaction.create` mints a user
|
|
51
|
+
// message whose only part is `type: "compaction"` — present from the moment
|
|
52
|
+
// an attempt starts, success or failure. It marks the turn as a compaction
|
|
53
|
+
// but is NOT content (it exists for attempts that summarised nothing) —
|
|
54
|
+
// that is what lets a failed attempt whose error landed on a PLAIN
|
|
55
|
+
// assistant message (the loop died before minting the summary-flagged one)
|
|
56
|
+
// still classify as a failed compaction instead of a bare error turn.
|
|
57
|
+
const userParts = turn.userMessage?.parts ?? [];
|
|
58
|
+
const hasRequestMarker = userParts.some((p) => p.type === 'compaction');
|
|
59
|
+
if (hasRequestMarker)
|
|
60
|
+
isCompaction = true;
|
|
61
|
+
// The synthetic-turn case: a summary message with no user prompt to attach
|
|
62
|
+
// to becomes the turn's userMessage. Its TEXT only counts under the summary
|
|
63
|
+
// flag, so a real user prompt's text can never count as summary content.
|
|
64
|
+
if (turn.userMessage && scanSummaryInfo(turn.userMessage.info)) {
|
|
65
|
+
scanParts(turn.userMessage.parts);
|
|
66
|
+
}
|
|
67
|
+
for (const msg of turn.assistantMessages) {
|
|
68
|
+
scanSummaryInfo(msg.info);
|
|
69
|
+
scanParts(msg.parts);
|
|
70
|
+
}
|
|
71
|
+
// Request accepted, reply not minted yet: the marker exists but no
|
|
72
|
+
// assistant message does — the gap between the compaction user message
|
|
73
|
+
// arriving and the summary message starting. Without this the turn reads
|
|
74
|
+
// "failed" for those frames and the failed row flickers in at stream start.
|
|
75
|
+
if (hasRequestMarker && turn.assistantMessages.length === 0)
|
|
76
|
+
inFlight = true;
|
|
77
|
+
return { isCompaction, hasContent, inFlight, error };
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=compaction-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction-state.js","sourceRoot":"","sources":["../../../../src/core/turns/segments/compaction-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA2BH,MAAM,UAAU,kBAAkB,CAAC,IAAwB;IACzD,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,KAAK,GAAY,IAAI,CAAC;IAE1B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5E,yEAAyE;IACzE,IAAI,IAAI,CAAC,WAAW,IAAI,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/D,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,mEAAmE;IACnE,uEAAuE;IACvE,yEAAyE;IACzE,4EAA4E;IAC5E,IAAI,gBAAgB,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC;QAAE,QAAQ,GAAG,IAAI,CAAC;IAE7E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapse an ordered ToolPart[] into the story Easy mode tells.
|
|
3
|
+
*
|
|
4
|
+
* Consecutive calls in the same family become one step ("Read 6 files", "Wrote 6 files"),
|
|
5
|
+
* which is what turns a 60-call run into an ~8-line narrative. Two tools are exempt:
|
|
6
|
+
* show / show_user are distinct artifacts the user has to actually see, so folding them
|
|
7
|
+
* would hide output. That rule already exists in `session-activity-groups.ts` — we reuse
|
|
8
|
+
* it rather than restate it.
|
|
9
|
+
*/
|
|
10
|
+
import type { ToolPart } from '../../runtime/client.js';
|
|
11
|
+
import { type StepFamily } from './narration.js';
|
|
12
|
+
export interface Step {
|
|
13
|
+
/** Stable across re-renders: the callID of the step's first part. */
|
|
14
|
+
id: string;
|
|
15
|
+
family: StepFamily;
|
|
16
|
+
label: string;
|
|
17
|
+
parts: ToolPart[];
|
|
18
|
+
status: 'running' | 'error' | 'done';
|
|
19
|
+
durationMs?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function groupSteps(parts: ToolPart[]): Step[];
|
|
22
|
+
//# sourceMappingURL=group-steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-steps.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/segments/group-steps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,KAAK,UAAU,EAAiD,MAAM,aAAa,CAAC;AAE7F,MAAM,WAAW,IAAI;IACnB,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA4CD,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,CAoCpD"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapse an ordered ToolPart[] into the story Easy mode tells.
|
|
3
|
+
*
|
|
4
|
+
* Consecutive calls in the same family become one step ("Read 6 files", "Wrote 6 files"),
|
|
5
|
+
* which is what turns a 60-call run into an ~8-line narrative. Two tools are exempt:
|
|
6
|
+
* show / show_user are distinct artifacts the user has to actually see, so folding them
|
|
7
|
+
* would hide output. That rule already exists in `session-activity-groups.ts` — we reuse
|
|
8
|
+
* it rather than restate it.
|
|
9
|
+
*/
|
|
10
|
+
import { isEmptyShowPart, isNoGroupActivityTool } from './session-activity-groups.js';
|
|
11
|
+
import { familyForTool, narrateFailedStep, narrateStep } from './narration.js';
|
|
12
|
+
function statusOf(parts) {
|
|
13
|
+
if (parts.some((p) => p.state?.status === 'running' || p.state?.status === 'pending')) {
|
|
14
|
+
return 'running';
|
|
15
|
+
}
|
|
16
|
+
if (parts.some((p) => p.state?.status === 'error'))
|
|
17
|
+
return 'error';
|
|
18
|
+
return 'done';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Wall-clock duration of a step. `state.time` is not on the typed interface but
|
|
22
|
+
* is present at runtime — `advanced/advanced-panel.tsx` reads it the same way.
|
|
23
|
+
*/
|
|
24
|
+
function durationOf(parts) {
|
|
25
|
+
let start = Number.POSITIVE_INFINITY;
|
|
26
|
+
let end = 0;
|
|
27
|
+
for (const p of parts) {
|
|
28
|
+
const time = p.state.time;
|
|
29
|
+
if (typeof time?.start === 'number')
|
|
30
|
+
start = Math.min(start, time.start);
|
|
31
|
+
if (typeof time?.end === 'number')
|
|
32
|
+
end = Math.max(end, time.end);
|
|
33
|
+
}
|
|
34
|
+
if (!Number.isFinite(start) || end <= start)
|
|
35
|
+
return undefined;
|
|
36
|
+
return end - start;
|
|
37
|
+
}
|
|
38
|
+
function finalize(family, parts) {
|
|
39
|
+
const status = statusOf(parts);
|
|
40
|
+
return {
|
|
41
|
+
id: parts[0].callID,
|
|
42
|
+
family,
|
|
43
|
+
// A failed step must never wear success wording — "Wrote budget.csv" for a
|
|
44
|
+
// write that errored is the panel lying (W7).
|
|
45
|
+
label: status === 'error' ? narrateFailedStep(family, parts) : narrateStep(family, parts),
|
|
46
|
+
parts,
|
|
47
|
+
status,
|
|
48
|
+
// A duration must never sit next to a live spinner — a running step may
|
|
49
|
+
// still carry stale/partial `time` data from a prior run of the same
|
|
50
|
+
// callID, and pairing that with the shimmer would visually claim the
|
|
51
|
+
// step is both finished and still going.
|
|
52
|
+
durationMs: status === 'running' ? undefined : durationOf(parts),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function groupSteps(parts) {
|
|
56
|
+
const steps = [];
|
|
57
|
+
let family = null;
|
|
58
|
+
let buffer = [];
|
|
59
|
+
const flush = () => {
|
|
60
|
+
if (family && buffer.length)
|
|
61
|
+
steps.push(finalize(family, buffer));
|
|
62
|
+
family = null;
|
|
63
|
+
buffer = [];
|
|
64
|
+
};
|
|
65
|
+
for (const part of parts) {
|
|
66
|
+
const f = familyForTool(part.tool);
|
|
67
|
+
if (f === 'hidden')
|
|
68
|
+
continue; // dropped, and must not split a run
|
|
69
|
+
// A `show` that handed nothing over is hidden for the same reason: its own
|
|
70
|
+
// step would narrate "Showed you the result" and open onto an empty card.
|
|
71
|
+
// Dropped here, before the standalone branch, so it also cannot split a run.
|
|
72
|
+
if (isEmptyShowPart(part))
|
|
73
|
+
continue;
|
|
74
|
+
// show / show_user each stand alone.
|
|
75
|
+
if (isNoGroupActivityTool(part.tool)) {
|
|
76
|
+
flush();
|
|
77
|
+
steps.push(finalize(f, [part]));
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (f !== family) {
|
|
81
|
+
flush();
|
|
82
|
+
family = f;
|
|
83
|
+
}
|
|
84
|
+
buffer.push(part);
|
|
85
|
+
}
|
|
86
|
+
flush();
|
|
87
|
+
return steps;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=group-steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-steps.js","sourceRoot":"","sources":["../../../../src/core/turns/segments/group-steps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAmB,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAY7F,SAAS,QAAQ,CAAC,KAAiB;IACjC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC,EAAE,CAAC;QACtF,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,CAAC,CAA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0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transcript structure — how a turn's parts become the rows a reader sees.
|
|
3
|
+
*
|
|
4
|
+
* Segmentation (bursts vs text vs standalone tools), same-family step
|
|
5
|
+
* grouping ("Read 6 files"), burst summaries ("Working · N steps"), thought
|
|
6
|
+
* merging ("Thought for 12s"), plain-language narration, the working-turn
|
|
7
|
+
* resolver, compaction state, and message timestamps. Pure data → data, no
|
|
8
|
+
* framework, so web and mobile render the same transcript from one source.
|
|
9
|
+
*/
|
|
10
|
+
export * from './burst-summary.js';
|
|
11
|
+
export * from './compaction-state.js';
|
|
12
|
+
export * from './group-steps.js';
|
|
13
|
+
export * from './merge-steps.js';
|
|
14
|
+
export * from './message-time.js';
|
|
15
|
+
export * from './narration.js';
|
|
16
|
+
export * from './segment-turn.js';
|
|
17
|
+
export * from './session-activity-groups.js';
|
|
18
|
+
export * from './step-label.js';
|
|
19
|
+
export * from './working-turn.js';
|
|
20
|
+
export * from './turn-busy-visibility.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/segments/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transcript structure — how a turn's parts become the rows a reader sees.
|
|
3
|
+
*
|
|
4
|
+
* Segmentation (bursts vs text vs standalone tools), same-family step
|
|
5
|
+
* grouping ("Read 6 files"), burst summaries ("Working · N steps"), thought
|
|
6
|
+
* merging ("Thought for 12s"), plain-language narration, the working-turn
|
|
7
|
+
* resolver, compaction state, and message timestamps. Pure data → data, no
|
|
8
|
+
* framework, so web and mobile render the same transcript from one source.
|
|
9
|
+
*/
|
|
10
|
+
export * from './burst-summary.js';
|
|
11
|
+
export * from './compaction-state.js';
|
|
12
|
+
export * from './group-steps.js';
|
|
13
|
+
export * from './merge-steps.js';
|
|
14
|
+
export * from './message-time.js';
|
|
15
|
+
export * from './narration.js';
|
|
16
|
+
export * from './segment-turn.js';
|
|
17
|
+
export * from './session-activity-groups.js';
|
|
18
|
+
export * from './step-label.js';
|
|
19
|
+
export * from './working-turn.js';
|
|
20
|
+
export * from './turn-busy-visibility.js';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/turns/segments/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Burst parts → the rows a reader actually sees.
|
|
3
|
+
*
|
|
4
|
+
* Three rules, all about reducing the row count rather than the information:
|
|
5
|
+
*
|
|
6
|
+
* 1. Plumbing never appears. Memory reads/writes and context compaction are
|
|
7
|
+
* machinery the reader did not ask for and cannot act on.
|
|
8
|
+
* 2. A run of consecutive thinking collapses into ONE row. The model emits
|
|
9
|
+
* reasoning in fragments; rendering a row per fragment turns a single
|
|
10
|
+
* train of thought into a wall of near-identical lines.
|
|
11
|
+
* 3. A run of consecutive same-family tool calls collapses into ONE group
|
|
12
|
+
* row that opens to its members. Two reads and two commands are two pieces
|
|
13
|
+
* of work, not four; expanding a burst to seven flat siblings un-groups
|
|
14
|
+
* exactly what makes a 60-call run readable.
|
|
15
|
+
*
|
|
16
|
+
* A thought row also carries whether IT is the one still being written. That
|
|
17
|
+
* cannot be answered by the burst around it: a trailing burst reports "running"
|
|
18
|
+
* for the whole turn on purpose (so the disclosure does not blink shut between
|
|
19
|
+
* SSE tool calls), so a burst-wide flag makes every thought a turn ever emitted
|
|
20
|
+
* claim to be live — shimmering, and forcing its paragraph open, twenty steps
|
|
21
|
+
* after it closed. See `reasoningIsRunning` and the settle pass at the end of
|
|
22
|
+
* `mergeBurstSteps`.
|
|
23
|
+
*
|
|
24
|
+
* Rule 3 reuses `groupSteps` — the same model the Easy action panel renders
|
|
25
|
+
* from — rather than restating the family table here. There is one grouping
|
|
26
|
+
* implementation; two that must agree forever is the trap this avoids.
|
|
27
|
+
*
|
|
28
|
+
* No React import — every rule here is unit-tested.
|
|
29
|
+
*/
|
|
30
|
+
import type { Part } from '../../runtime/client.js';
|
|
31
|
+
import { type Step } from './group-steps.js';
|
|
32
|
+
import type { StepTier } from './step-label.js';
|
|
33
|
+
export type BurstStep = {
|
|
34
|
+
kind: 'thought';
|
|
35
|
+
key: string;
|
|
36
|
+
texts: string[];
|
|
37
|
+
running: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* How long the whole run of reasoning took, in ms — first fragment's
|
|
40
|
+
* `time.start` to the last one's `time.end`.
|
|
41
|
+
*
|
|
42
|
+
* Undefined when either end is missing (a live thought has no end yet,
|
|
43
|
+
* and some providers send no timing at all), so the row can tell "not
|
|
44
|
+
* timed" apart from "took no time" and fall back to the bare label
|
|
45
|
+
* rather than printing a zero.
|
|
46
|
+
*/
|
|
47
|
+
durationMs?: number;
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'part';
|
|
50
|
+
key: string;
|
|
51
|
+
part: Part;
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'group';
|
|
54
|
+
key: string;
|
|
55
|
+
step: Step;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* True while the model is still writing this reasoning fragment.
|
|
59
|
+
*
|
|
60
|
+
* A closed reasoning block carries `time.end`; an open one has a start and
|
|
61
|
+
* nothing else. Exported so `burstIsRunning` asks the same question in the same
|
|
62
|
+
* words — two copies of this predicate is exactly how a burst and the rows
|
|
63
|
+
* inside it end up disagreeing about who is still working.
|
|
64
|
+
*/
|
|
65
|
+
export declare function reasoningIsRunning(part: Part): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* `tierOf` is injected rather than imported so the merge rules can be tested
|
|
68
|
+
* without dragging the whole tool-name table in behind them.
|
|
69
|
+
*/
|
|
70
|
+
export declare function mergeBurstSteps(parts: ReadonlyArray<Part>, tierOf: (part: Part) => StepTier): BurstStep[];
|
|
71
|
+
/**
|
|
72
|
+
* A run of thinking fragments → the one sentence the row shows.
|
|
73
|
+
*
|
|
74
|
+
* Fragments are joined, stripped of document markup, and given a "Thinking
|
|
75
|
+
* about" lead-in — unless they already open with a thinking verb, where the
|
|
76
|
+
* prefix would read as a stutter ("Thinking about thinking about…").
|
|
77
|
+
*/
|
|
78
|
+
export declare function flattenThought(texts: ReadonlyArray<string>): string;
|
|
79
|
+
//# sourceMappingURL=merge-steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-steps.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/segments/merge-steps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,MAAM,SAAS,GACjB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAGtD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,EAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,QAAQ,GAC/B,SAAS,EAAE,CAmHb;AAmBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAkBnE"}
|