@smthrs/harness 1.0.0-rc.3 → 1.0.0-rc.4
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/cjs/ExternalTranscript.d.ts.map +1 -1
- package/dist/cjs/ExternalTranscript.js.map +2 -2
- package/dist/cjs/Transcript.d.ts +1 -1
- package/dist/cjs/Transcript.d.ts.map +1 -1
- package/dist/cjs/Transcript.js.map +1 -1
- package/dist/esm/ExternalTranscript.d.ts.map +1 -1
- package/dist/esm/ExternalTranscript.js +2 -4
- package/dist/esm/ExternalTranscript.js.map +1 -1
- package/dist/esm/Transcript.d.ts +1 -1
- package/dist/esm/Transcript.d.ts.map +1 -1
- package/dist/esm/Transcript.js.map +1 -1
- package/package.json +10 -10
- package/src/ExternalTranscript.ts +3 -4
- package/src/Transcript.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transcript.js","sourceRoot":"","sources":["../../src/Transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAG7C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,UAAU,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,cAAc,MAAM,8BAA8B,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAE/B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,C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C;IACD,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,QAAQ;QACR,QAAQ;QACR,IAAI,EAAE;YACJ,QAAQ;YACR,OAAO;YACP,YAAY;YACZ,YAAY;YACZ,OAAO,EAAE,YAAY;YACrB,WAAW;YACX,WAAW;YACX,MAAM;SACP;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,OAA0C,EAC2B,EAAE,CACvE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;AAEhG;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA","sourcesContent":["/**\n * Transcript projection from durable journal entries.\n *\n * The transcript grows: what the model saw is what it said plus what the\n * harness answered, in journal order. A `continue` used to be able to replace\n * the whole projection with a list of messages the cell had written for its\n * successor, and that branch is gone with the surface that produced it — a\n * journal from those waves still decodes, and its `context` entries are simply\n * not read.\n *\n * @since 0.1.0\n */\n\nimport * as Fault from \"@smthrs/flow/Fault\"\nimport type { JournalEvent } from \"@smthrs/journal\"\nimport { ModelRequest } from \"@smthrs/model\"\nimport { Result, Schema } from \"effect\"\nimport * as AgentEvent from \"./AgentEvent.ts\"\nimport type * as Cell from \"./Cell.ts\"\nimport type * as EngineLike from \"./EngineLike.ts\"\nimport * as FailedCall from \"./FailedCall.ts\"\nimport { HarnessError } from \"./HarnessError.ts\"\nimport * as DemandText from \"./internal/demandText.ts\"\nimport { printsObservation } from \"./internal/printsObservation.ts\"\nimport * as UnobservedCall from \"./internal/unobservedCall.ts\"\n\n/**\n * Journal and model-key format after summaries became user context.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const journalVersion = 2\n\n/**\n * The event-type namespace a session journals its controller events under.\n *\n * Resume validation reads only the entries under this prefix, and the writer\n * that produces them lives in another package, so the prefix is exported here\n * rather than spelled twice: a writer types its event types as\n * {@link ControlEventType} and a rename fails to compile instead of silently\n * emptying the set {@link validateJournal} inspects.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const controlEventPrefix = \"control.agent.\"\n\n/**\n * An event type {@link validateJournal} validates.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ControlEventType = `${typeof controlEventPrefix}${string}`\n\n/**\n * Refuses history whose replay could address different sealed model steps.\n * Historical display projection is separate from permission to resume.\n *\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const validateJournal = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<void, HarnessError> => {\n for (const entry of entries) {\n if (!entry.eventType.startsWith(controlEventPrefix)) continue\n const payload = entry.payload as Record<string, unknown> | null\n if (payload === null || typeof payload !== \"object\" || payload[\"journalVersion\"] !== journalVersion) {\n return Result.fail(\n new HarnessError({\n code: \"incompatible_journal\",\n message: `Journal sequence ${entry.seq} predates harness journal format ${journalVersion}; start a new run.`\n })\n )\n }\n }\n return Result.succeed(undefined)\n}\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const TranscriptErrorCode = Schema.Literals([\"projection_failed\"])\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type TranscriptErrorCode = typeof TranscriptErrorCode.Type\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category errors\n * @since 0.1.0\n * @slop\n */\nexport class TranscriptError extends Schema.TaggedError<TranscriptError>()(\"flows/harness/TranscriptError\", {\n code: TranscriptErrorCode,\n message: Schema.String,\n cause: Schema.optional(Schema.Defect())\n}) {}\nFault.register(\"flows/harness/TranscriptError\", { projection_failed: \"bug\" } satisfies Fault.Rows<TranscriptErrorCode>)\n\n/**\n * The kind and message of one projected transcript item.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface ProjectedMessage {\n readonly kind: \"transcript\" | \"summary\" | \"steering\"\n readonly message: ModelRequest.Message\n}\n\n/**\n * A projection with the compaction replacement identity, when one was recorded.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface ProjectedState {\n readonly messages: ReadonlyArray<ProjectedMessage>\n readonly replaced?: string | undefined\n readonly cell: CellEvidence\n}\n\n/**\n * Schema-decoded cell evidence consumed while rebuilding a journal.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface CellEvidence {\n readonly produced: ReadonlyArray<Cell.Source>\n /**\n * What each frame printed, in journal order.\n *\n * The print buffer is the whole of the context channel: it is what the NEXT\n * model turn reads, and `AgentEvent.CellPrinted` is journaled rather than\n * derived precisely so a projection can rebuild that window without\n * re-running anything. It was missing from this decoder, so a transcript\n * projected from a harness-native journal could not reconstruct what the\n * model saw.\n */\n readonly printed: ReadonlyArray<AgentEvent.CellPrinted>\n readonly callsStarted: ReadonlyArray<Cell.Call>\n readonly callsSettled: ReadonlyArray<AgentEvent.CellCallSettled>\n readonly settled: ReadonlyArray<AgentEvent.CellSettled>\n readonly transitions: ReadonlyArray<Cell.Transition>\n readonly suspensions: ReadonlyArray<EngineLike.SuspendReason>\n readonly aborts: ReadonlyArray<string>\n}\n\n/** The one journal-event-type table; see `AgentEvent.eventType`. */\nconst eventType = AgentEvent.eventType\n\nconst projectionFailed = (entry: JournalEvent.Entry, cause: unknown): TranscriptError =>\n new TranscriptError({\n code: \"projection_failed\",\n message: `Invalid ${entry.eventType} payload at journal sequence ${entry.seq}`,\n cause\n })\n\nconst decode = <A>(\n decodePayload: (payload: unknown) => Result.Result<A, unknown>,\n entry: JournalEvent.Entry\n): Result.Result<A, TranscriptError> =>\n Result.mapError(decodePayload(entry.payload), (cause) => projectionFailed(entry, cause))\n\nconst ordered = (entries: ReadonlyArray<JournalEvent.Entry>): ReadonlyArray<JournalEvent.Entry> =>\n [...entries].sort((left, right) => left.seq - right.seq)\n\nconst decodeModelSettled = Schema.decodeUnknownResult(AgentEvent.ModelSettled)\nconst decodeSteeringDrained = Schema.decodeUnknownResult(AgentEvent.SteeringDrained)\nconst decodeCompactionSettled = Schema.decodeUnknownResult(AgentEvent.CompactionSettled)\nconst decodeCellPrinted = Schema.decodeUnknownResult(AgentEvent.CellPrinted)\nconst decodeCellProduced = Schema.decodeUnknownResult(AgentEvent.CellProduced)\nconst decodeCellCallStarted = Schema.decodeUnknownResult(AgentEvent.CellCallStarted)\nconst decodeCellCallSettled = Schema.decodeUnknownResult(AgentEvent.CellCallSettled)\nconst decodeCellSettled = Schema.decodeUnknownResult(AgentEvent.CellSettled)\nconst decodeTransitionApplied = Schema.decodeUnknownResult(AgentEvent.TransitionApplied)\nconst decodeSuspended = Schema.decodeUnknownResult(AgentEvent.Suspended)\nconst decodeAborted = Schema.decodeUnknownResult(AgentEvent.Aborted)\nconst decodeReadOnlyDemandIssued = Schema.decodeUnknownResult(AgentEvent.ReadOnlyDemandIssued)\nconst decodeRepeatDemanded = Schema.decodeUnknownResult(AgentEvent.RepeatDemanded)\nconst decodeNarrowedDemanded = Schema.decodeUnknownResult(AgentEvent.NarrowedDemanded)\nconst decodeNarrowOnlyDemanded = Schema.decodeUnknownResult(AgentEvent.NarrowOnlyDemanded)\nconst decodeUnmovedDemanded = Schema.decodeUnknownResult(AgentEvent.UnmovedDemanded)\nconst decodeUnresolvedDemanded = Schema.decodeUnknownResult(AgentEvent.UnresolvedDemanded)\nconst decodeFailedCallDemanded = Schema.decodeUnknownResult(AgentEvent.FailedCallDemanded)\nconst decodeUnobservedDemanded = Schema.decodeUnknownResult(AgentEvent.UnobservedDemanded)\nconst decodeOutputDemanded = Schema.decodeUnknownResult(AgentEvent.OutputDemanded)\nconst decodeClaimDemanded = Schema.decodeUnknownResult(AgentEvent.ClaimDemanded)\n\nconst transcriptMessage = (\n message: ModelRequest.AssistantMessage\n): ModelRequest.AssistantMessage =>\n message.stopReason === \"error\" || message.stopReason === \"aborted\"\n ? new ModelRequest.AssistantMessage({\n role: \"assistant\",\n content: message.content.map((part) =>\n part.type === \"thinking\"\n ? ModelRequest.ThinkingPart.make({ text: part.text })\n : part\n ),\n stopReason: message.stopReason\n })\n : message\n\n/**\n * Projects journal events into their model-visible transcript state as typed\n * data, preserving malformed payload failures instead of throwing.\n *\n * This rebuilds turn structure, the settlement's own message, and every\n * journaled controller demand. The controller also folds frame-local\n * settled-call salvage and the memory-probe alert into failure notes. A raised\n * cell's `bindingPathMiss` hint is live-only, so the projection rebuilds a\n * shorter note exactly where that hint would name a missed binding.\n *\n * A terminal frame has the opposite skew: `observe` appends no observation\n * once the frame budget is spent, while this projection rebuilds its journaled\n * print and settlement. On a run whose last frame was terminal, it therefore\n * over-reports by one trailing user turn. `AgentEvent.TurnClosed.outcome` is the\n * journaled signal a future projection would key on to drop it: `\"resolved\"`\n * on the terminal frame and `\"continue\"` otherwise.\n *\n * @category projections\n * @since 0.1.0\n * @slop\n */\nexport const projectStateResult = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<ProjectedState, TranscriptError> => {\n const events = ordered(entries)\n const produced: Array<Cell.Source> = []\n const printed: Array<AgentEvent.CellPrinted> = []\n const prints = new Map<number, AgentEvent.CellPrinted>()\n const callsStarted: Array<Cell.Call> = []\n const callsSettled: Array<AgentEvent.CellCallSettled> = []\n const settledCells: Array<AgentEvent.CellSettled> = []\n const transitions: Array<Cell.Transition> = []\n const suspensions: Array<EngineLike.SuspendReason> = []\n const aborts: Array<string> = []\n const compactions = new Map<number, AgentEvent.CompactionSettled>()\n let replaced: string | undefined\n // Legacy events replaced everything before themselves. Preserve that\n // behavior, including skipping obsolete model payloads, for old journals.\n let legacyBoundary = Number.NEGATIVE_INFINITY\n\n for (const entry of events) {\n switch (entry.eventType) {\n case eventType.cellProduced: {\n const decoded = decode(decodeCellProduced, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n produced.push(decoded.success.cell)\n break\n }\n case eventType.cellPrinted: {\n const decoded = decode(decodeCellPrinted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n printed.push(decoded.success)\n // Decoded once, here, and read back by sequence below. The payload is\n // retained so a failed settlement can prove the immediately preceding\n // print belongs to the same cell before merging the two observations.\n prints.set(entry.seq, decoded.success)\n break\n }\n case eventType.cellCallStarted: {\n const decoded = decode(decodeCellCallStarted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n callsStarted.push(decoded.success.call)\n break\n }\n case eventType.cellCallSettled: {\n const decoded = decode(decodeCellCallSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n callsSettled.push(decoded.success)\n break\n }\n case eventType.cellSettled: {\n const decoded = decode(decodeCellSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n settledCells.push(decoded.success)\n break\n }\n case eventType.transitionApplied: {\n const decoded = decode(decodeTransitionApplied, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n transitions.push(decoded.success.transition)\n break\n }\n case eventType.suspended: {\n const decoded = decode(decodeSuspended, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n suspensions.push(decoded.success.reason)\n break\n }\n case eventType.aborted: {\n const decoded = decode(decodeAborted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n aborts.push(decoded.success.reason)\n break\n }\n case eventType.compactionSettled: {\n const decoded = decode(decodeCompactionSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n compactions.set(entry.seq, decoded.success)\n replaced = decoded.success.replacedPrefixDigest\n if (decoded.success.retainedMessageCount === undefined) legacyBoundary = entry.seq\n break\n }\n }\n }\n\n const messages: Array<ProjectedMessage> = []\n // Set only after emitting a print and cleared whenever another message is\n // emitted, so presence means the last projected turn is exactly this print.\n let precedingPrint: AgentEvent.CellPrinted | undefined\n const appendDemand = (text: string): void => {\n messages.push({ kind: \"transcript\", message: ModelRequest.Message.user(text) })\n precedingPrint = undefined\n }\n\n for (const entry of events) {\n if (entry.seq < legacyBoundary) continue\n const compaction = compactions.get(entry.seq)\n if (compaction !== undefined) {\n // Apply each boundary to the already-projected messages so repeated\n // compactions replace prior summaries without dropping the recent tail.\n // A marked compaction carries the replaced messages it kept verbatim\n // after its summary, and may carry no summary when nothing was squashed.\n const summary = compaction.summary\n messages.splice(\n 0,\n Math.max(0, messages.length - (compaction.retainedMessageCount ?? 0)),\n ...(summary === undefined ? [] : [{\n kind: \"summary\" as const,\n message: summary.role === \"user\"\n ? summary\n : ModelRequest.Message.user(\n summary.content.filter((part): part is ModelRequest.TextPart => part.type === \"text\")\n )\n }]),\n ...(compaction.kept ?? []).map((message) => ({ kind: \"transcript\" as const, message }))\n )\n precedingPrint = undefined\n continue\n }\n // The print buffer is the context channel: what a cell printed is what the\n // next model turn read, in the place the journal put it.\n const print = prints.get(entry.seq)\n if (print !== undefined) {\n messages.push({\n kind: \"transcript\",\n message: ModelRequest.Message.user(printsObservation(print.text))\n })\n precedingPrint = print\n continue\n }\n switch (entry.eventType) {\n case eventType.modelSettled: {\n const decoded = decode(decodeModelSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n if (decoded.success.message.content.length === 0) break\n messages.push({ kind: \"transcript\", message: transcriptMessage(decoded.success.message) })\n precedingPrint = undefined\n break\n }\n case eventType.steeringDrained: {\n const decoded = decode(decodeSteeringDrained, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n for (const message of decoded.success.messages) {\n messages.push({ kind: \"steering\", message })\n precedingPrint = undefined\n }\n break\n }\n case eventType.readOnlyDemandIssued: {\n const decoded = decode(decodeReadOnlyDemandIssued, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.readOnly(decoded.success.cap, decoded.success.streak))\n break\n }\n case eventType.repeatDemanded: {\n const decoded = decode(decodeRepeatDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.repeat(decoded.success.frames, decoded.success.cap))\n break\n }\n case eventType.narrowedDemanded: {\n const decoded = decode(decodeNarrowedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.narrowed(decoded.success.flow, decoded.success.broader, decoded.success.narrower))\n break\n }\n case eventType.narrowOnlyDemanded: {\n const decoded = decode(decodeNarrowOnlyDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.narrowOnly(decoded.success.flow, decoded.success.check, decoded.success.targets))\n break\n }\n case eventType.unmovedDemanded: {\n const decoded = decode(decodeUnmovedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.unmoved(decoded.success.openedDigest, decoded.success.currentDigest))\n break\n }\n case eventType.unresolvedDemanded: {\n const decoded = decode(decodeUnresolvedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.unresolved(decoded.success.flow, decoded.success.failed, decoded.success.instead))\n break\n }\n case eventType.failedCallDemanded: {\n const decoded = decode(decodeFailedCallDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(FailedCall.demand(decoded.success.failures))\n break\n }\n case eventType.unobservedDemanded: {\n const decoded = decode(decodeUnobservedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(UnobservedCall.demand(decoded.success.calls))\n break\n }\n case eventType.outputDemanded: {\n const decoded = decode(decodeOutputDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(decoded.success.note)\n break\n }\n case eventType.claimDemanded: {\n const decoded = decode(decodeClaimDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n // The reading that let a completion through was journaled too, and it\n // put nothing in front of the model, so only a firing is replayed.\n if (decoded.success.demanded) {\n appendDemand(DemandText.claim())\n }\n break\n }\n case eventType.cellSettled: {\n const decoded = decode(decodeCellSettled, entry)\n /* v8 ignore next -- the first pass ran `decodeCellSettled` over every `cellSettled` entry of this same `events` array and returned on failure, and `decode` is a pure function of `entry.payload`, so re-decoding an entry that survived that pass cannot fail; the branch exists because `Result` has no way to carry that proof */\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n const outcome = decoded.success.outcome\n if (outcome._tag !== \"rejected\" && outcome._tag !== \"raised\") break\n const note = outcome._tag === \"rejected\"\n ? outcome.message\n : `The cell threw ${outcome.name}: ${outcome.message}. Emit a corrected cell.`\n if (precedingPrint !== undefined && precedingPrint.cell === decoded.success.cell) {\n messages[messages.length - 1] = {\n kind: \"transcript\",\n message: ModelRequest.Message.user(`${printsObservation(precedingPrint.text)}\\n\\n${note}`)\n }\n } else {\n messages.push({\n kind: \"transcript\",\n message: ModelRequest.Message.user(note)\n })\n }\n precedingPrint = undefined\n break\n }\n }\n }\n return Result.succeed({\n messages,\n replaced,\n cell: {\n produced,\n printed,\n callsStarted,\n callsSettled,\n settled: settledCells,\n transitions,\n suspensions,\n aborts\n }\n })\n}\n\n/**\n * Projects model-visible messages in canonical journal sequence order.\n *\n * @category projections\n * @since 0.1.0\n * @slop\n */\nexport const projectResult = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<ReadonlyArray<ModelRequest.Message>, TranscriptError> =>\n Result.map(projectStateResult(entries), (state) => state.messages.map((item) => item.message))\n\n/**\n * Pure external-source decoders; never create executable journal identities.\n * @since 1.0.0-rc.1\n */\nexport { decodeClaude, decodeCodex } from \"./ExternalTranscript.ts\"\nexport type { Entry as ExternalEntry, Decoded as ExternalDecoded } from \"./ExternalTranscript.ts\"\n"]}
|
|
1
|
+
{"version":3,"file":"Transcript.js","sourceRoot":"","sources":["../../src/Transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAA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;oBACjF,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG;wBAC9B,IAAI,EAAE,YAAY;wBAClB,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;qBAC3F,CAAA;gBACH,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,YAAY;wBAClB,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;qBACzC,CAAC,CAAA;gBACJ,CAAC;gBACD,cAAc,GAAG,SAAS,CAAA;gBAC1B,MAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,QAAQ;QACR,QAAQ;QACR,IAAI,EAAE;YACJ,QAAQ;YACR,OAAO;YACP,YAAY;YACZ,YAAY;YACZ,OAAO,EAAE,YAAY;YACrB,WAAW;YACX,WAAW;YACX,MAAM;SACP;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,OAA0C,EAC2B,EAAE,CACvE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;AAEhG;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA","sourcesContent":["/**\n * Transcript projection from durable journal entries.\n *\n * The transcript grows: what the model saw is what it said plus what the\n * harness answered, in journal order. A `continue` used to be able to replace\n * the whole projection with a list of messages the cell had written for its\n * successor, and that branch is gone with the surface that produced it — a\n * journal from those waves still decodes, and its `context` entries are simply\n * not read.\n *\n * @since 0.1.0\n */\n\nimport * as Fault from \"@smthrs/flow/Fault\"\nimport type { JournalEvent } from \"@smthrs/journal\"\nimport { ModelRequest } from \"@smthrs/model\"\nimport { Result, Schema } from \"effect\"\nimport * as AgentEvent from \"./AgentEvent.ts\"\nimport type * as Cell from \"./Cell.ts\"\nimport type * as EngineLike from \"./EngineLike.ts\"\nimport * as FailedCall from \"./FailedCall.ts\"\nimport { HarnessError } from \"./HarnessError.ts\"\nimport * as DemandText from \"./internal/demandText.ts\"\nimport { printsObservation } from \"./internal/printsObservation.ts\"\nimport * as UnobservedCall from \"./internal/unobservedCall.ts\"\n\n/**\n * Journal and model-key format after summaries became user context.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const journalVersion = 2\n\n/**\n * The event-type namespace a session journals its controller events under.\n *\n * Resume validation reads only the entries under this prefix, and the writer\n * that produces them lives in another package, so the prefix is exported here\n * rather than spelled twice: a writer types its event types as\n * {@link ControlEventType} and a rename fails to compile instead of silently\n * emptying the set {@link validateJournal} inspects.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const controlEventPrefix = \"control.agent.\"\n\n/**\n * An event type {@link validateJournal} validates.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ControlEventType = `${typeof controlEventPrefix}${string}`\n\n/**\n * Refuses history whose replay could address different sealed model steps.\n * Historical display projection is separate from permission to resume.\n *\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const validateJournal = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<void, HarnessError> => {\n for (const entry of entries) {\n if (!entry.eventType.startsWith(controlEventPrefix)) continue\n const payload = entry.payload as Record<string, unknown> | null\n if (payload === null || typeof payload !== \"object\" || payload[\"journalVersion\"] !== journalVersion) {\n return Result.fail(\n new HarnessError({\n code: \"incompatible_journal\",\n message: `Journal sequence ${entry.seq} predates harness journal format ${journalVersion}; start a new run.`\n })\n )\n }\n }\n return Result.succeed(undefined)\n}\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const TranscriptErrorCode = Schema.Literals([\"projection_failed\"])\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type TranscriptErrorCode = typeof TranscriptErrorCode.Type\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category errors\n * @since 0.1.0\n * @slop\n */\nexport class TranscriptError extends Schema.TaggedError<TranscriptError>()(\"flows/harness/TranscriptError\", {\n code: TranscriptErrorCode,\n message: Schema.String,\n cause: Schema.optional(Schema.Defect())\n}) {}\nFault.register(\"flows/harness/TranscriptError\", { projection_failed: \"bug\" } satisfies Fault.Rows<TranscriptErrorCode>)\n\n/**\n * The kind and message of one projected transcript item.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface ProjectedMessage {\n readonly kind: \"transcript\" | \"summary\" | \"steering\"\n readonly message: ModelRequest.Message\n}\n\n/**\n * A projection with the compaction replacement identity, when one was recorded.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface ProjectedState {\n readonly messages: ReadonlyArray<ProjectedMessage>\n readonly replaced?: string | undefined\n readonly cell: CellEvidence\n}\n\n/**\n * Schema-decoded cell evidence consumed while rebuilding a journal.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface CellEvidence {\n readonly produced: ReadonlyArray<Cell.Source>\n /**\n * What each frame printed, in journal order.\n *\n * The print buffer is the whole of the context channel: it is what the NEXT\n * model turn reads, and `AgentEvent.CellPrinted` is journaled rather than\n * derived precisely so a projection can rebuild that window without\n * re-running anything. It was missing from this decoder, so a transcript\n * projected from a harness-native journal could not reconstruct what the\n * model saw.\n */\n readonly printed: ReadonlyArray<AgentEvent.CellPrinted>\n readonly callsStarted: ReadonlyArray<Cell.Call>\n readonly callsSettled: ReadonlyArray<AgentEvent.CellCallSettled>\n readonly settled: ReadonlyArray<AgentEvent.CellSettled>\n readonly transitions: ReadonlyArray<Cell.Transition>\n readonly suspensions: ReadonlyArray<EngineLike.SuspendReason>\n readonly aborts: ReadonlyArray<string>\n}\n\n/** The one journal-event-type table; see `AgentEvent.eventType`. */\nconst eventType = AgentEvent.eventType\n\nconst projectionFailed = (entry: JournalEvent.Entry, cause: unknown): TranscriptError =>\n new TranscriptError({\n code: \"projection_failed\",\n message: `Invalid ${entry.eventType} payload at journal sequence ${entry.seq}`,\n cause\n })\n\nconst decode = <A>(\n decodePayload: (payload: unknown) => Result.Result<A, unknown>,\n entry: JournalEvent.Entry\n): Result.Result<A, TranscriptError> =>\n Result.mapError(decodePayload(entry.payload), (cause) => projectionFailed(entry, cause))\n\nconst ordered = (entries: ReadonlyArray<JournalEvent.Entry>): ReadonlyArray<JournalEvent.Entry> =>\n [...entries].sort((left, right) => left.seq - right.seq)\n\nconst decodeModelSettled = Schema.decodeUnknownResult(AgentEvent.ModelSettled)\nconst decodeSteeringDrained = Schema.decodeUnknownResult(AgentEvent.SteeringDrained)\nconst decodeCompactionSettled = Schema.decodeUnknownResult(AgentEvent.CompactionSettled)\nconst decodeCellPrinted = Schema.decodeUnknownResult(AgentEvent.CellPrinted)\nconst decodeCellProduced = Schema.decodeUnknownResult(AgentEvent.CellProduced)\nconst decodeCellCallStarted = Schema.decodeUnknownResult(AgentEvent.CellCallStarted)\nconst decodeCellCallSettled = Schema.decodeUnknownResult(AgentEvent.CellCallSettled)\nconst decodeCellSettled = Schema.decodeUnknownResult(AgentEvent.CellSettled)\nconst decodeTransitionApplied = Schema.decodeUnknownResult(AgentEvent.TransitionApplied)\nconst decodeSuspended = Schema.decodeUnknownResult(AgentEvent.Suspended)\nconst decodeAborted = Schema.decodeUnknownResult(AgentEvent.Aborted)\nconst decodeReadOnlyDemandIssued = Schema.decodeUnknownResult(AgentEvent.ReadOnlyDemandIssued)\nconst decodeRepeatDemanded = Schema.decodeUnknownResult(AgentEvent.RepeatDemanded)\nconst decodeNarrowedDemanded = Schema.decodeUnknownResult(AgentEvent.NarrowedDemanded)\nconst decodeNarrowOnlyDemanded = Schema.decodeUnknownResult(AgentEvent.NarrowOnlyDemanded)\nconst decodeUnmovedDemanded = Schema.decodeUnknownResult(AgentEvent.UnmovedDemanded)\nconst decodeUnresolvedDemanded = Schema.decodeUnknownResult(AgentEvent.UnresolvedDemanded)\nconst decodeFailedCallDemanded = Schema.decodeUnknownResult(AgentEvent.FailedCallDemanded)\nconst decodeUnobservedDemanded = Schema.decodeUnknownResult(AgentEvent.UnobservedDemanded)\nconst decodeOutputDemanded = Schema.decodeUnknownResult(AgentEvent.OutputDemanded)\nconst decodeClaimDemanded = Schema.decodeUnknownResult(AgentEvent.ClaimDemanded)\n\nconst transcriptMessage = (\n message: ModelRequest.AssistantMessage\n): ModelRequest.AssistantMessage =>\n message.stopReason === \"error\" || message.stopReason === \"aborted\"\n ? new ModelRequest.AssistantMessage({\n role: \"assistant\",\n content: message.content.map((part) =>\n part.type === \"thinking\"\n ? ModelRequest.ThinkingPart.make({ text: part.text })\n : part\n ),\n stopReason: message.stopReason\n })\n : message\n\n/**\n * Projects journal events into their model-visible transcript state as typed\n * data, preserving malformed payload failures instead of throwing.\n *\n * This rebuilds turn structure, the settlement's own message, and every\n * journaled controller demand. The controller also folds frame-local\n * settled-call salvage and the memory-probe alert into failure notes. A raised\n * cell's `bindingPathMiss` hint is live-only, so the projection rebuilds a\n * shorter note exactly where that hint would name a missed binding.\n *\n * A terminal frame has the opposite skew: `observe` appends no observation\n * once the frame budget is spent, while this projection rebuilds its journaled\n * print and settlement. On a run whose last frame was terminal, it therefore\n * over-reports by one trailing user turn. `AgentEvent.TurnClosed.outcome` is the\n * journaled signal a future projection would key on to drop it: `\"resolved\"`\n * on the terminal frame and `\"continue\"` otherwise.\n *\n * @category projections\n * @since 0.1.0\n * @slop\n */\nexport const projectStateResult = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<ProjectedState, TranscriptError> => {\n const events = ordered(entries)\n const produced: Array<Cell.Source> = []\n const printed: Array<AgentEvent.CellPrinted> = []\n const prints = new Map<number, AgentEvent.CellPrinted>()\n const callsStarted: Array<Cell.Call> = []\n const callsSettled: Array<AgentEvent.CellCallSettled> = []\n const settledCells: Array<AgentEvent.CellSettled> = []\n const transitions: Array<Cell.Transition> = []\n const suspensions: Array<EngineLike.SuspendReason> = []\n const aborts: Array<string> = []\n const compactions = new Map<number, AgentEvent.CompactionSettled>()\n let replaced: string | undefined\n // Legacy events replaced everything before themselves. Preserve that\n // behavior, including skipping obsolete model payloads, for old journals.\n let legacyBoundary = Number.NEGATIVE_INFINITY\n\n for (const entry of events) {\n switch (entry.eventType) {\n case eventType.cellProduced: {\n const decoded = decode(decodeCellProduced, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n produced.push(decoded.success.cell)\n break\n }\n case eventType.cellPrinted: {\n const decoded = decode(decodeCellPrinted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n printed.push(decoded.success)\n // Decoded once, here, and read back by sequence below. The payload is\n // retained so a failed settlement can prove the immediately preceding\n // print belongs to the same cell before merging the two observations.\n prints.set(entry.seq, decoded.success)\n break\n }\n case eventType.cellCallStarted: {\n const decoded = decode(decodeCellCallStarted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n callsStarted.push(decoded.success.call)\n break\n }\n case eventType.cellCallSettled: {\n const decoded = decode(decodeCellCallSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n callsSettled.push(decoded.success)\n break\n }\n case eventType.cellSettled: {\n const decoded = decode(decodeCellSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n settledCells.push(decoded.success)\n break\n }\n case eventType.transitionApplied: {\n const decoded = decode(decodeTransitionApplied, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n transitions.push(decoded.success.transition)\n break\n }\n case eventType.suspended: {\n const decoded = decode(decodeSuspended, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n suspensions.push(decoded.success.reason)\n break\n }\n case eventType.aborted: {\n const decoded = decode(decodeAborted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n aborts.push(decoded.success.reason)\n break\n }\n case eventType.compactionSettled: {\n const decoded = decode(decodeCompactionSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n compactions.set(entry.seq, decoded.success)\n replaced = decoded.success.replacedPrefixDigest\n if (decoded.success.retainedMessageCount === undefined) legacyBoundary = entry.seq\n break\n }\n }\n }\n\n const messages: Array<ProjectedMessage> = []\n // Set only after emitting a print and cleared whenever another message is\n // emitted, so presence means the last projected turn is exactly this print.\n let precedingPrint: AgentEvent.CellPrinted | undefined\n const appendDemand = (text: string): void => {\n messages.push({ kind: \"transcript\", message: ModelRequest.Message.user(text) })\n precedingPrint = undefined\n }\n\n for (const entry of events) {\n if (entry.seq < legacyBoundary) continue\n const compaction = compactions.get(entry.seq)\n if (compaction !== undefined) {\n // Apply each boundary to the already-projected messages so repeated\n // compactions replace prior summaries without dropping the recent tail.\n // A marked compaction carries the replaced messages it kept verbatim\n // after its summary, and may carry no summary when nothing was squashed.\n const summary = compaction.summary\n messages.splice(\n 0,\n Math.max(0, messages.length - (compaction.retainedMessageCount ?? 0)),\n ...(summary === undefined ? [] : [{\n kind: \"summary\" as const,\n message: summary.role === \"user\"\n ? summary\n : ModelRequest.Message.user(\n summary.content.filter((part): part is ModelRequest.TextPart => part.type === \"text\")\n )\n }]),\n ...(compaction.kept ?? []).map((message) => ({ kind: \"transcript\" as const, message }))\n )\n precedingPrint = undefined\n continue\n }\n // The print buffer is the context channel: what a cell printed is what the\n // next model turn read, in the place the journal put it.\n const print = prints.get(entry.seq)\n if (print !== undefined) {\n messages.push({\n kind: \"transcript\",\n message: ModelRequest.Message.user(printsObservation(print.text))\n })\n precedingPrint = print\n continue\n }\n switch (entry.eventType) {\n case eventType.modelSettled: {\n const decoded = decode(decodeModelSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n if (decoded.success.message.content.length === 0) break\n messages.push({ kind: \"transcript\", message: transcriptMessage(decoded.success.message) })\n precedingPrint = undefined\n break\n }\n case eventType.steeringDrained: {\n const decoded = decode(decodeSteeringDrained, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n for (const message of decoded.success.messages) {\n messages.push({ kind: \"steering\", message })\n precedingPrint = undefined\n }\n break\n }\n case eventType.readOnlyDemandIssued: {\n const decoded = decode(decodeReadOnlyDemandIssued, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.readOnly(decoded.success.cap, decoded.success.streak))\n break\n }\n case eventType.repeatDemanded: {\n const decoded = decode(decodeRepeatDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.repeat(decoded.success.frames, decoded.success.cap))\n break\n }\n case eventType.narrowedDemanded: {\n const decoded = decode(decodeNarrowedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.narrowed(decoded.success.flow, decoded.success.broader, decoded.success.narrower))\n break\n }\n case eventType.narrowOnlyDemanded: {\n const decoded = decode(decodeNarrowOnlyDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.narrowOnly(decoded.success.flow, decoded.success.check, decoded.success.targets))\n break\n }\n case eventType.unmovedDemanded: {\n const decoded = decode(decodeUnmovedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.unmoved(decoded.success.openedDigest, decoded.success.currentDigest))\n break\n }\n case eventType.unresolvedDemanded: {\n const decoded = decode(decodeUnresolvedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.unresolved(decoded.success.flow, decoded.success.failed, decoded.success.instead))\n break\n }\n case eventType.failedCallDemanded: {\n const decoded = decode(decodeFailedCallDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(FailedCall.demand(decoded.success.failures))\n break\n }\n case eventType.unobservedDemanded: {\n const decoded = decode(decodeUnobservedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(UnobservedCall.demand(decoded.success.calls))\n break\n }\n case eventType.outputDemanded: {\n const decoded = decode(decodeOutputDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(decoded.success.note)\n break\n }\n case eventType.claimDemanded: {\n const decoded = decode(decodeClaimDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n // The reading that let a completion through was journaled too, and it\n // put nothing in front of the model, so only a firing is replayed.\n if (decoded.success.demanded) {\n appendDemand(DemandText.claim())\n }\n break\n }\n case eventType.cellSettled: {\n const decoded = decode(decodeCellSettled, entry)\n /* v8 ignore next -- the first pass ran `decodeCellSettled` over every `cellSettled` entry of this same `events` array and returned on failure, and `decode` is a pure function of `entry.payload`, so re-decoding an entry that survived that pass cannot fail; the branch exists because `Result` has no way to carry that proof */\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n const outcome = decoded.success.outcome\n if (outcome._tag !== \"rejected\" && outcome._tag !== \"raised\") break\n const note = outcome._tag === \"rejected\"\n ? outcome.message\n : `The cell threw ${outcome.name}: ${outcome.message}. Emit a corrected cell.`\n if (precedingPrint !== undefined && precedingPrint.cell === decoded.success.cell) {\n messages[messages.length - 1] = {\n kind: \"transcript\",\n message: ModelRequest.Message.user(`${printsObservation(precedingPrint.text)}\\n\\n${note}`)\n }\n } else {\n messages.push({\n kind: \"transcript\",\n message: ModelRequest.Message.user(note)\n })\n }\n precedingPrint = undefined\n break\n }\n }\n }\n return Result.succeed({\n messages,\n replaced,\n cell: {\n produced,\n printed,\n callsStarted,\n callsSettled,\n settled: settledCells,\n transitions,\n suspensions,\n aborts\n }\n })\n}\n\n/**\n * Projects model-visible messages in canonical journal sequence order.\n *\n * @category projections\n * @since 0.1.0\n * @slop\n */\nexport const projectResult = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<ReadonlyArray<ModelRequest.Message>, TranscriptError> =>\n Result.map(projectStateResult(entries), (state) => state.messages.map((item) => item.message))\n\n/**\n * Pure external-source decoders; never create executable journal identities.\n * @since 1.0.0-rc.1\n */\nexport { decodeClaude, decodeCodex } from \"./ExternalTranscript.ts\"\nexport type { Decoded as ExternalDecoded, Entry as ExternalEntry } from \"./ExternalTranscript.ts\"\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smthrs/harness",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"smthrs": {
|
|
7
7
|
"group": "agent"
|
|
@@ -418,17 +418,17 @@
|
|
|
418
418
|
"@babel/parser": "8.0.4",
|
|
419
419
|
"@babel/types": "8.0.4",
|
|
420
420
|
"@jitl/quickjs-singlefile-browser-release-sync": "0.32.0",
|
|
421
|
-
"@smthrs/capability": "1.0.0-rc.
|
|
422
|
-
"@smthrs/core": "1.0.0-rc.
|
|
423
|
-
"@smthrs/flow": "1.0.0-rc.
|
|
424
|
-
"@smthrs/journal": "1.0.0-rc.
|
|
425
|
-
"@smthrs/kernel": "1.0.0-rc.
|
|
426
|
-
"@smthrs/model": "1.0.0-rc.
|
|
427
|
-
"@smthrs/notifications": "1.0.0-rc.
|
|
428
|
-
"@smthrs/registry": "1.0.0-rc.
|
|
421
|
+
"@smthrs/capability": "1.0.0-rc.4",
|
|
422
|
+
"@smthrs/core": "1.0.0-rc.4",
|
|
423
|
+
"@smthrs/flow": "1.0.0-rc.4",
|
|
424
|
+
"@smthrs/journal": "1.0.0-rc.4",
|
|
425
|
+
"@smthrs/kernel": "1.0.0-rc.4",
|
|
426
|
+
"@smthrs/model": "1.0.0-rc.4",
|
|
427
|
+
"@smthrs/notifications": "1.0.0-rc.4",
|
|
428
|
+
"@smthrs/registry": "1.0.0-rc.4",
|
|
429
429
|
"quickjs-emscripten-core": "0.32.0",
|
|
430
430
|
"sucrase": "3.35.1",
|
|
431
|
-
"@smthrs/canonical": "1.0.0-rc.
|
|
431
|
+
"@smthrs/canonical": "1.0.0-rc.4"
|
|
432
432
|
},
|
|
433
433
|
"devDependencies": {
|
|
434
434
|
"@effect/language-service": "0.87.2",
|
|
@@ -871,10 +871,9 @@ const claudeToolPart = (
|
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
873
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
*/
|
|
874
|
+
// The Claude Code record, status, attachment and block kinds this module names. Each list is closed: a kind
|
|
875
|
+
// outside it is a tagged `unsupported_record`, so a new kind stops the import where a person can see it.
|
|
876
|
+
|
|
878
877
|
/** Rows outside the conversation chain: session bookkeeping that names no speaker and says nothing. */
|
|
879
878
|
const claudeSkippedRows = [
|
|
880
879
|
"mode",
|
package/src/Transcript.ts
CHANGED
|
@@ -510,4 +510,4 @@ export const projectResult = (
|
|
|
510
510
|
* @since 1.0.0-rc.1
|
|
511
511
|
*/
|
|
512
512
|
export { decodeClaude, decodeCodex } from "./ExternalTranscript.ts"
|
|
513
|
-
export type {
|
|
513
|
+
export type { Decoded as ExternalDecoded, Entry as ExternalEntry } from "./ExternalTranscript.ts"
|