@namzu/sdk 62.6.0 → 62.7.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/CHANGELOG.md +35 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +5 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/agents/examples/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/examples/SupervisorAgent.js +1 -0
- package/dist/agents/examples/SupervisorAgent.js.map +1 -1
- package/dist/agents/explore.d.ts.map +1 -1
- package/dist/agents/explore.js +2 -1
- package/dist/agents/explore.js.map +1 -1
- package/dist/compaction/index.d.ts +1 -1
- package/dist/compaction/index.d.ts.map +1 -1
- package/dist/compaction/index.js +1 -1
- package/dist/compaction/index.js.map +1 -1
- package/dist/compaction/model-summary.js +2 -2
- package/dist/compaction/model-summary.js.map +1 -1
- package/dist/compaction/summary.d.ts +16 -1
- package/dist/compaction/summary.d.ts.map +1 -1
- package/dist/compaction/summary.js +25 -2
- package/dist/compaction/summary.js.map +1 -1
- package/dist/config/runtime.d.ts +8 -0
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +15 -0
- package/dist/config/runtime.js.map +1 -1
- package/dist/execution/workflow/runtime.d.ts.map +1 -1
- package/dist/execution/workflow/runtime.js +3 -0
- package/dist/execution/workflow/runtime.js.map +1 -1
- package/dist/execution/workflow/types.d.ts +8 -0
- package/dist/execution/workflow/types.d.ts.map +1 -1
- package/dist/manager/agent/child-session.d.ts +12 -0
- package/dist/manager/agent/child-session.d.ts.map +1 -1
- package/dist/manager/agent/child-session.js +29 -0
- package/dist/manager/agent/child-session.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +8 -0
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/session/turn-recorder.d.ts +13 -2
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +57 -3
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +3 -3
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +5 -3
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +5 -1
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/retry.d.ts +25 -0
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +28 -0
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +3 -3
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +3 -3
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +4 -2
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +5 -2
- package/dist/public-tools.js.map +1 -1
- package/dist/runtime/query/auto-review/classifier.d.ts +7 -1
- package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/classifier.js +8 -4
- package/dist/runtime/query/auto-review/classifier.js.map +1 -1
- package/dist/runtime/query/auto-review/prompt.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/prompt.js +2 -0
- package/dist/runtime/query/auto-review/prompt.js.map +1 -1
- package/dist/runtime/query/auto-review/script-evidence.d.ts +93 -0
- package/dist/runtime/query/auto-review/script-evidence.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/script-evidence.js +566 -0
- package/dist/runtime/query/auto-review/script-evidence.js.map +1 -0
- package/dist/runtime/query/checkpoint.d.ts +13 -0
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +37 -0
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +38 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +130 -11
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/finalize-turn.d.ts +7 -1
- package/dist/runtime/query/finalize-turn.d.ts.map +1 -1
- package/dist/runtime/query/finalize-turn.js +2 -0
- package/dist/runtime/query/finalize-turn.js.map +1 -1
- package/dist/runtime/query/index.d.ts +8 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +7 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +32 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +158 -10
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts +12 -0
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +48 -1
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js +5 -0
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +3 -3
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/prelude-lease.d.ts.map +1 -1
- package/dist/runtime/query/prelude-lease.js +22 -0
- package/dist/runtime/query/prelude-lease.js.map +1 -1
- package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
- package/dist/runtime/query/prepare-turn.js +13 -4
- package/dist/runtime/query/prepare-turn.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +29 -0
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +2 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +1 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/runtime/query/turn/completion-audit.d.ts +27 -1
- package/dist/runtime/query/turn/completion-audit.d.ts.map +1 -1
- package/dist/runtime/query/turn/completion-audit.js +71 -6
- package/dist/runtime/query/turn/completion-audit.js.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.d.ts +113 -0
- package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -0
- package/dist/runtime/query/turn/outcome-ledger.js +578 -0
- package/dist/runtime/query/turn/outcome-ledger.js.map +1 -0
- package/dist/sandbox/file-walk.d.ts.map +1 -1
- package/dist/sandbox/file-walk.js +34 -17
- package/dist/sandbox/file-walk.js.map +1 -1
- package/dist/sandbox/glob-segment.d.ts +35 -0
- package/dist/sandbox/glob-segment.d.ts.map +1 -0
- package/dist/sandbox/glob-segment.js +300 -0
- package/dist/sandbox/glob-segment.js.map +1 -0
- package/dist/store/session-log/index.d.ts +1 -0
- package/dist/store/session-log/index.d.ts.map +1 -1
- package/dist/store/session-log/index.js +1 -0
- package/dist/store/session-log/index.js.map +1 -1
- package/dist/store/session-log/turn-outcome.d.ts +37 -0
- package/dist/store/session-log/turn-outcome.d.ts.map +1 -0
- package/dist/store/session-log/turn-outcome.js +77 -0
- package/dist/store/session-log/turn-outcome.js.map +1 -0
- package/dist/tools/builtins/bash.js +1 -1
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/edit-apply.d.ts.map +1 -1
- package/dist/tools/builtins/edit-apply.js +24 -3
- package/dist/tools/builtins/edit-apply.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts +31 -17
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +92 -27
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/glob.js +1 -1
- package/dist/tools/builtins/glob.js.map +1 -1
- package/dist/tools/builtins/grep.js +1 -1
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/notebook-guard.d.ts +19 -0
- package/dist/tools/builtins/notebook-guard.d.ts.map +1 -0
- package/dist/tools/builtins/notebook-guard.js +75 -0
- package/dist/tools/builtins/notebook-guard.js.map +1 -0
- package/dist/tools/builtins/read-render.d.ts.map +1 -1
- package/dist/tools/builtins/read-render.js +8 -2
- package/dist/tools/builtins/read-render.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +14 -1
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/coordinator/agent.d.ts.map +1 -1
- package/dist/tools/coordinator/agent.js +25 -6
- package/dist/tools/coordinator/agent.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +6 -1
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/coordinator/outcome-record.d.ts +22 -0
- package/dist/tools/coordinator/outcome-record.d.ts.map +1 -0
- package/dist/tools/coordinator/outcome-record.js +91 -0
- package/dist/tools/coordinator/outcome-record.js.map +1 -0
- package/dist/tools/defineTool.d.ts +2 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +1 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/file-read-tracker.d.ts +23 -2
- package/dist/tools/file-read-tracker.d.ts.map +1 -1
- package/dist/tools/file-read-tracker.js +37 -2
- package/dist/tools/file-read-tracker.js.map +1 -1
- package/dist/tools/untrusted-envelope.d.ts +6 -0
- package/dist/tools/untrusted-envelope.d.ts.map +1 -1
- package/dist/tools/untrusted-envelope.js +22 -1
- package/dist/tools/untrusted-envelope.js.map +1 -1
- package/dist/toolsets/manager.d.ts.map +1 -1
- package/dist/toolsets/manager.js +3 -4
- package/dist/toolsets/manager.js.map +1 -1
- package/dist/toolsets/validation-issues.d.ts +27 -0
- package/dist/toolsets/validation-issues.d.ts.map +1 -0
- package/dist/toolsets/validation-issues.js +83 -0
- package/dist/toolsets/validation-issues.js.map +1 -0
- package/dist/turn/memory-recall.d.ts +13 -0
- package/dist/turn/memory-recall.d.ts.map +1 -1
- package/dist/turn/memory-recall.js +18 -0
- package/dist/turn/memory-recall.js.map +1 -1
- package/dist/types/agent/base.d.ts +19 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/query.d.ts +2 -0
- package/dist/types/agent/query.d.ts.map +1 -1
- package/dist/types/common/index.d.ts +17 -0
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js +8 -1
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/hitl/index.d.ts +22 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/session/config.d.ts +20 -0
- package/dist/types/session/config.d.ts.map +1 -1
- package/dist/types/session/events.d.ts +3 -3
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/index.d.ts +1 -0
- package/dist/types/session/index.d.ts.map +1 -1
- package/dist/types/session/index.js +1 -0
- package/dist/types/session/index.js.map +1 -1
- package/dist/types/session/outcome.d.ts +95 -0
- package/dist/types/session/outcome.d.ts.map +1 -0
- package/dist/types/session/outcome.js +45 -0
- package/dist/types/session/outcome.js.map +1 -0
- package/dist/types/session/prepare-step.d.ts +2 -0
- package/dist/types/session/prepare-step.d.ts.map +1 -1
- package/dist/types/session/records.d.ts +167 -2
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +42 -0
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/session/turn.d.ts +18 -0
- package/dist/types/session/turn.d.ts.map +1 -1
- package/dist/types/session/turn.js.map +1 -1
- package/dist/types/tool/index.d.ts +30 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/package.json +2 -2
- package/src/agents/QueryAgent.ts +5 -0
- package/src/agents/examples/SupervisorAgent.ts +1 -0
- package/src/agents/explore.ts +2 -1
- package/src/compaction/index.ts +1 -0
- package/src/compaction/model-summary.ts +2 -2
- package/src/compaction/summary.ts +30 -2
- package/src/config/runtime.ts +15 -0
- package/src/execution/workflow/runtime.ts +4 -0
- package/src/execution/workflow/types.ts +9 -0
- package/src/manager/agent/child-session.ts +36 -0
- package/src/manager/agent/lifecycle.ts +9 -0
- package/src/manager/session/turn-recorder.ts +62 -3
- package/src/pricing/rates.source.json +1 -1
- package/src/prompt/coding-agent-doctrine.ts +5 -3
- package/src/provider/fallback.ts +6 -1
- package/src/provider/retry.ts +51 -0
- package/src/public-runtime.ts +10 -1
- package/src/public-tools.ts +6 -1
- package/src/runtime/query/auto-review/classifier.ts +21 -5
- package/src/runtime/query/auto-review/prompt.ts +2 -0
- package/src/runtime/query/auto-review/script-evidence.ts +618 -0
- package/src/runtime/query/checkpoint.ts +53 -1
- package/src/runtime/query/executor.ts +159 -19
- package/src/runtime/query/finalize-turn.ts +8 -1
- package/src/runtime/query/index.ts +19 -0
- package/src/runtime/query/iteration/index.ts +167 -14
- package/src/runtime/query/iteration/phases/compaction.ts +53 -3
- package/src/runtime/query/iteration/phases/context.ts +6 -0
- package/src/runtime/query/iteration/stream-turn.ts +3 -3
- package/src/runtime/query/prelude-lease.ts +19 -0
- package/src/runtime/query/prepare-turn.ts +13 -4
- package/src/runtime/query/review-policy.ts +33 -0
- package/src/runtime/query/tooling.ts +3 -0
- package/src/runtime/query/turn/completion-audit.ts +76 -5
- package/src/runtime/query/turn/outcome-ledger.ts +633 -0
- package/src/sandbox/file-walk.ts +38 -17
- package/src/sandbox/glob-segment.ts +309 -0
- package/src/store/session-log/index.ts +7 -0
- package/src/store/session-log/turn-outcome.ts +84 -0
- package/src/tools/builtins/bash.ts +1 -1
- package/src/tools/builtins/edit-apply.ts +26 -4
- package/src/tools/builtins/edit.ts +106 -41
- package/src/tools/builtins/glob.ts +1 -1
- package/src/tools/builtins/grep.ts +1 -1
- package/src/tools/builtins/notebook-guard.ts +76 -0
- package/src/tools/builtins/read-render.ts +12 -2
- package/src/tools/builtins/write-file.ts +12 -1
- package/src/tools/coordinator/agent.ts +31 -7
- package/src/tools/coordinator/index.ts +6 -1
- package/src/tools/coordinator/outcome-record.ts +93 -0
- package/src/tools/defineTool.ts +3 -0
- package/src/tools/file-read-tracker.ts +51 -2
- package/src/tools/untrusted-envelope.ts +23 -1
- package/src/toolsets/manager.ts +6 -10
- package/src/toolsets/validation-issues.ts +97 -0
- package/src/turn/memory-recall.ts +28 -0
- package/src/types/agent/base.ts +20 -0
- package/src/types/agent/query.ts +2 -0
- package/src/types/common/index.ts +25 -1
- package/src/types/hitl/index.ts +27 -0
- package/src/types/session/config.ts +20 -0
- package/src/types/session/events.ts +3 -3
- package/src/types/session/index.ts +1 -0
- package/src/types/session/outcome.ts +139 -0
- package/src/types/session/prepare-step.ts +2 -0
- package/src/types/session/records.ts +67 -1
- package/src/types/session/turn.ts +19 -0
- package/src/types/tool/index.ts +30 -0
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type SessionEvent,
|
|
26
26
|
type SessionEventType,
|
|
27
27
|
} from './events.js'
|
|
28
|
+
import type { TurnSettlement } from './turn.js'
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* The session log: one append-only, hash-chained JSONL file per session, the
|
|
@@ -594,6 +595,49 @@ export const AccountBoundRecordSchema = recordSchema('account_bound', {
|
|
|
594
595
|
reason: z.enum(['start', 'user_switch', 'limit_switch']),
|
|
595
596
|
})
|
|
596
597
|
|
|
598
|
+
/**
|
|
599
|
+
* The three records below carry the turn's outcome record
|
|
600
|
+
* (`docs/sdk/turn-outcome.md`). Each is `ignorable: true`: a release that does
|
|
601
|
+
* not know the type keeps it in the hash chain and skips it (see
|
|
602
|
+
* `IgnorableRecordSchema`), so a log written with them still reads there and
|
|
603
|
+
* loses only the outcome. None of them may become a field of a record that
|
|
604
|
+
* existed before them, because a release that validates that record strictly
|
|
605
|
+
* would refuse the whole log. The body is checked only for being an object
|
|
606
|
+
* here; `TurnOutcomeSchema` judges it where it is read back, so a later
|
|
607
|
+
* release may widen it without making this one refuse the log.
|
|
608
|
+
*/
|
|
609
|
+
const outcomeBody = z.custom<Readonly<Record<string, unknown>>>(isPlainObject, {
|
|
610
|
+
message: 'expected an object',
|
|
611
|
+
})
|
|
612
|
+
|
|
613
|
+
/** A turn's final outcome, written just before its `turn_completed` or `turn_failed`. */
|
|
614
|
+
export const TurnOutcomeRecordedRecordSchema = inTurn('turn_outcome_recorded', {
|
|
615
|
+
ignorable: z.literal(true),
|
|
616
|
+
outcome: outcomeBody,
|
|
617
|
+
})
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* A delegated child's outcome, written in the parent's log just before the
|
|
621
|
+
* child's `child_session_ended`. Carries the spawning turn's id only while that
|
|
622
|
+
* turn is open, as `child_session_ended` does.
|
|
623
|
+
*/
|
|
624
|
+
export const ChildOutcomeRecordedRecordSchema = recordSchema('child_outcome_recorded', {
|
|
625
|
+
ignorable: z.literal(true),
|
|
626
|
+
childSessionId: sessionId,
|
|
627
|
+
outcome: outcomeBody,
|
|
628
|
+
})
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* What the turn's outcome record had gathered when a checkpoint was written,
|
|
632
|
+
* so a resume can restore it. Written just before the `checkpoint_written`
|
|
633
|
+
* record of the same `checkpointId`.
|
|
634
|
+
*/
|
|
635
|
+
export const OutcomeProgressWrittenRecordSchema = inTurn('outcome_progress_written', {
|
|
636
|
+
ignorable: z.literal(true),
|
|
637
|
+
checkpointId,
|
|
638
|
+
progress: outcomeBody,
|
|
639
|
+
})
|
|
640
|
+
|
|
597
641
|
export const LogRepairedRecordSchema = recordSchema('log_repaired', {
|
|
598
642
|
truncatedBytes: positive,
|
|
599
643
|
lastGoodSeq: positive,
|
|
@@ -632,6 +676,9 @@ const RECORD_ONLY_SCHEMAS = {
|
|
|
632
676
|
budget_bound: BudgetBoundRecordSchema,
|
|
633
677
|
account_bound: AccountBoundRecordSchema,
|
|
634
678
|
log_repaired: LogRepairedRecordSchema,
|
|
679
|
+
turn_outcome_recorded: TurnOutcomeRecordedRecordSchema,
|
|
680
|
+
child_outcome_recorded: ChildOutcomeRecordedRecordSchema,
|
|
681
|
+
outcome_progress_written: OutcomeProgressWrittenRecordSchema,
|
|
635
682
|
} as const
|
|
636
683
|
|
|
637
684
|
export type SessionRecordOnlyType = keyof typeof RECORD_ONLY_SCHEMAS
|
|
@@ -1006,8 +1053,21 @@ type EventOf<T extends SessionEventType> = Extract<SessionEvent, { type: T }>
|
|
|
1006
1053
|
*/
|
|
1007
1054
|
export type SessionEventRecord<T extends PersistedSessionEventType = PersistedSessionEventType> =
|
|
1008
1055
|
T extends PersistedSessionEventType
|
|
1009
|
-
? Omit<
|
|
1056
|
+
? Omit<
|
|
1057
|
+
EventOf<T>,
|
|
1058
|
+
| 'sessionId'
|
|
1059
|
+
| 'turnId'
|
|
1060
|
+
| 'lineage'
|
|
1061
|
+
| 'v'
|
|
1062
|
+
| 'seq'
|
|
1063
|
+
| 'generation'
|
|
1064
|
+
// The live settlement carries the outcome record; the log's does not.
|
|
1065
|
+
| (T extends 'turn_completed' | 'turn_failed' ? 'settlement' : never)
|
|
1066
|
+
> &
|
|
1010
1067
|
RecordEnvelope &
|
|
1068
|
+
(T extends 'turn_completed' | 'turn_failed'
|
|
1069
|
+
? { readonly settlement: TurnSettlement }
|
|
1070
|
+
: unknown) &
|
|
1011
1071
|
(T extends 'tool_completed'
|
|
1012
1072
|
? {
|
|
1013
1073
|
readonly structuredResultSpill?: z.infer<typeof structuredResultSpill>
|
|
@@ -1036,6 +1096,9 @@ export type AuditRecord = z.infer<typeof AuditRecordSchema>
|
|
|
1036
1096
|
export type BudgetBoundRecord = z.infer<typeof BudgetBoundRecordSchema>
|
|
1037
1097
|
export type AccountBoundRecord = z.infer<typeof AccountBoundRecordSchema>
|
|
1038
1098
|
export type LogRepairedRecord = z.infer<typeof LogRepairedRecordSchema>
|
|
1099
|
+
export type TurnOutcomeRecordedRecord = z.infer<typeof TurnOutcomeRecordedRecordSchema>
|
|
1100
|
+
export type ChildOutcomeRecordedRecord = z.infer<typeof ChildOutcomeRecordedRecordSchema>
|
|
1101
|
+
export type OutcomeProgressWrittenRecord = z.infer<typeof OutcomeProgressWrittenRecordSchema>
|
|
1039
1102
|
|
|
1040
1103
|
export type SessionRecordOnly =
|
|
1041
1104
|
| SessionStartedRecord
|
|
@@ -1053,6 +1116,9 @@ export type SessionRecordOnly =
|
|
|
1053
1116
|
| BudgetBoundRecord
|
|
1054
1117
|
| AccountBoundRecord
|
|
1055
1118
|
| LogRepairedRecord
|
|
1119
|
+
| TurnOutcomeRecordedRecord
|
|
1120
|
+
| ChildOutcomeRecordedRecord
|
|
1121
|
+
| OutcomeProgressWrittenRecord
|
|
1056
1122
|
|
|
1057
1123
|
/** One line of a session log. */
|
|
1058
1124
|
export type SessionRecord = SessionEventRecord | SessionRecordOnly
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
import type { Message } from '../message/index.js'
|
|
12
12
|
import type { ProviderErrorInfo } from '../provider/index.js'
|
|
13
13
|
import type { TurnConfig } from './config.js'
|
|
14
|
+
import type { TurnOutcome } from './outcome.js'
|
|
14
15
|
import type { StepResult } from './step.js'
|
|
15
16
|
import type { StopReason } from './stop-reason.js'
|
|
16
17
|
|
|
@@ -151,6 +152,22 @@ export interface TurnSettlement {
|
|
|
151
152
|
readonly abandonedJobIds: readonly string[]
|
|
152
153
|
}
|
|
153
154
|
|
|
155
|
+
/**
|
|
156
|
+
* The settlement a live `turn_completed` or `turn_failed` event carries: the
|
|
157
|
+
* persisted {@link TurnSettlement} plus the turn's outcome record. The record
|
|
158
|
+
* is in memory only here. The session log keeps it in its own records
|
|
159
|
+
* (`turn_outcome_recorded`), never in the settlement, so a release that
|
|
160
|
+
* validates the settlement strictly still reads the log.
|
|
161
|
+
*/
|
|
162
|
+
export interface LiveTurnSettlement extends TurnSettlement {
|
|
163
|
+
/**
|
|
164
|
+
* What the turn changed and what checked it, from its own tool calls. Absent
|
|
165
|
+
* for a turn that never ran the loop and one resumed from a checkpoint that
|
|
166
|
+
* did not keep the record.
|
|
167
|
+
*/
|
|
168
|
+
readonly outcome?: TurnOutcome
|
|
169
|
+
}
|
|
170
|
+
|
|
154
171
|
/** Metadata of one turn: who ran it, with what, and where it sits in the session tree. */
|
|
155
172
|
export interface TurnMetadata {
|
|
156
173
|
/** This turn's owner, independent of a shared ancestor token account. */
|
|
@@ -216,6 +233,8 @@ export interface Turn {
|
|
|
216
233
|
abandonedTaskIds?: readonly string[]
|
|
217
234
|
/** Background jobs the model awaited that were still running when this turn ended. */
|
|
218
235
|
abandonedJobIds?: readonly string[]
|
|
236
|
+
/** What the turn changed and what checked it; see {@link LiveTurnSettlement.outcome}. */
|
|
237
|
+
outcome?: TurnOutcome
|
|
219
238
|
/** Present on a child session's turn. */
|
|
220
239
|
parentSessionId?: SessionId
|
|
221
240
|
/** Present on a child session's turn. */
|
package/src/types/tool/index.ts
CHANGED
|
@@ -331,6 +331,25 @@ export interface FileReadTracker {
|
|
|
331
331
|
* chain is cleared. Pass ToolContext.toolUseId only after the edit succeeded.
|
|
332
332
|
*/
|
|
333
333
|
recordEdit?(key: string, content: string, callId: string): void
|
|
334
|
+
/**
|
|
335
|
+
* Optional: the fingerprint of the content the agent itself last put in
|
|
336
|
+
* the file at `key` through a full write or an edit, if it did. A file the
|
|
337
|
+
* agent only read, or never touched, has none. Shell redirection is not
|
|
338
|
+
* seen here: such a file is of unknown authorship. Used by the auto-mode
|
|
339
|
+
* classifier to tell a script the agent wrote from one it did not.
|
|
340
|
+
*/
|
|
341
|
+
authoredFingerprint?(key: string): string | undefined
|
|
342
|
+
/** Optional: when this ledger began, in milliseconds since the epoch. */
|
|
343
|
+
readonly startedAt?: number
|
|
344
|
+
/**
|
|
345
|
+
* Optional: the ledger a delegated child starts with. Its own read record,
|
|
346
|
+
* empty, because what a child has read is not what its parent or a sibling
|
|
347
|
+
* has, and the stale-write refusal compares the disk to the reader's own
|
|
348
|
+
* reads. What the family authored ({@link authoredFingerprint},
|
|
349
|
+
* {@link startedAt}) is shared with it. A tracker without this is not
|
|
350
|
+
* handed to a child.
|
|
351
|
+
*/
|
|
352
|
+
forChild?(): FileReadTracker
|
|
334
353
|
/**
|
|
335
354
|
* Optional witness of a read that returned the file WHOLE, with the
|
|
336
355
|
* fingerprint of the rendering it returned.
|
|
@@ -1364,6 +1383,17 @@ export interface ToolDefinition<TInput = unknown> extends ToolPresentation<TInpu
|
|
|
1364
1383
|
* explicitly still bounds this tool's result by it.
|
|
1365
1384
|
*/
|
|
1366
1385
|
selfLimitingOutput?: boolean
|
|
1386
|
+
/**
|
|
1387
|
+
* A tighter model-visible cap, in characters, for THIS tool's result.
|
|
1388
|
+
*
|
|
1389
|
+
* The turn's cap (`maxToolOutputChars`, 40,000 by default) still applies;
|
|
1390
|
+
* the smaller of the two wins, including when a host turned the turn cap
|
|
1391
|
+
* off with `0`. A result over it is kept in the session's tool-results
|
|
1392
|
+
* folder and shown as a head-and-tail preview that names the file, the same
|
|
1393
|
+
* way any other oversized result is. Use it for a tool whose results are
|
|
1394
|
+
* foreign text that should cost less of the window than a file read does.
|
|
1395
|
+
*/
|
|
1396
|
+
maxOutputChars?: number
|
|
1367
1397
|
}
|
|
1368
1398
|
|
|
1369
1399
|
/**
|