@tangle-network/agent-app 0.45.13 → 0.45.15
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/README.md +6 -4
- package/dist/assistant/index.d.ts +3 -3
- package/dist/assistant/index.js +5 -5
- package/dist/chat-react/index.d.ts +58 -12
- package/dist/chat-react/index.js +96 -38
- package/dist/chat-react/index.js.map +1 -1
- package/dist/chat-routes/index.d.ts +3 -3
- package/dist/chat-routes/index.js +6 -6
- package/dist/chat-store/index.d.ts +4 -4
- package/dist/chat-store/index.js +3 -3
- package/dist/{chunk-CKUZVDZ7.js → chunk-2Z56V2ZW.js} +4 -4
- package/dist/{chunk-AIZZU6ZW.js → chunk-6JPFYXEU.js} +2 -2
- package/dist/{chunk-WUZZVQKR.js → chunk-B2UEW62O.js} +2 -2
- package/dist/{chunk-3ZK5IJSW.js → chunk-M3K2HVQD.js} +2 -2
- package/dist/chunk-M3K2HVQD.js.map +1 -0
- package/dist/{chunk-73F3CKVK.js → chunk-TH7L265V.js} +5 -17
- package/dist/chunk-TH7L265V.js.map +1 -0
- package/dist/{chunk-5EPIPT4V.js → chunk-XZ27ENOZ.js} +2 -2
- package/dist/{chunk-3BK3BC2L.js → chunk-ZSSCVT6H.js} +2 -2
- package/dist/{contract-CQNvv5th.d.ts → contract-OxG_jVMx.d.ts} +9 -27
- package/dist/design-canvas-react/index.js +4 -4
- package/dist/harness/index.d.ts +5 -12
- package/dist/harness/index.js +1 -1
- package/dist/interactions/index.d.ts +2 -2
- package/dist/interactions/index.js +2 -2
- package/dist/{parts-F8W3-iry.d.ts → parts-BqIHMdyu.d.ts} +1 -1
- package/dist/run/index.js +1 -1
- package/dist/sandbox/index.js +2 -2
- package/dist/skills-placement/index.js +1 -1
- package/dist/stream/index.d.ts +3 -3
- package/dist/stream/index.js +2 -2
- package/dist/{stream-normalizer-CnPnMaTp.d.ts → stream-normalizer-DKRxyVlZ.d.ts} +1 -1
- package/dist/web-react/index.d.ts +5 -5
- package/dist/web-react/index.js +5 -5
- package/dist/workspace-react/index.d.ts +89 -0
- package/dist/workspace-react/index.js +82 -0
- package/dist/workspace-react/index.js.map +1 -0
- package/package.json +16 -11
- package/dist/chunk-3ZK5IJSW.js.map +0 -1
- package/dist/chunk-73F3CKVK.js.map +0 -1
- /package/dist/{chunk-CKUZVDZ7.js.map → chunk-2Z56V2ZW.js.map} +0 -0
- /package/dist/{chunk-AIZZU6ZW.js.map → chunk-6JPFYXEU.js.map} +0 -0
- /package/dist/{chunk-WUZZVQKR.js.map → chunk-B2UEW62O.js.map} +0 -0
- /package/dist/{chunk-5EPIPT4V.js.map → chunk-XZ27ENOZ.js.map} +0 -0
- /package/dist/{chunk-3BK3BC2L.js.map → chunk-ZSSCVT6H.js.map} +0 -0
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-YTMKRL3L.js";
|
|
13
13
|
import {
|
|
14
14
|
attachmentPartsFromMessageParts
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-B2UEW62O.js";
|
|
16
16
|
import {
|
|
17
17
|
formatBytes
|
|
18
18
|
} from "./chunk-KWXUBMXU.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
parseInteractionRequest,
|
|
26
26
|
persistedPartToInteraction,
|
|
27
27
|
questionInteractionContentSignature
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-M3K2HVQD.js";
|
|
29
29
|
import {
|
|
30
30
|
parsePlanSubmittedEvent,
|
|
31
31
|
persistedPartToPlan
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import {
|
|
34
34
|
snapHarnessToModel,
|
|
35
35
|
snapModelToHarness
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-TH7L265V.js";
|
|
37
37
|
|
|
38
38
|
// src/web-react/index.tsx
|
|
39
39
|
import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef9, useState as useState14, memo } from "react";
|
|
@@ -4309,4 +4309,4 @@ export {
|
|
|
4309
4309
|
useThinkingSeconds,
|
|
4310
4310
|
ChatMessages
|
|
4311
4311
|
};
|
|
4312
|
-
//# sourceMappingURL=chunk-
|
|
4312
|
+
//# sourceMappingURL=chunk-2Z56V2ZW.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertHarnessModelCompatible
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TH7L265V.js";
|
|
4
4
|
import {
|
|
5
5
|
assertProfilePromptWithinBudget,
|
|
6
6
|
fingerprintAgentProfile
|
|
@@ -2237,4 +2237,4 @@ export {
|
|
|
2237
2237
|
isTerminalPromptEvent,
|
|
2238
2238
|
detectInteractiveQuestion
|
|
2239
2239
|
};
|
|
2240
|
-
//# sourceMappingURL=chunk-
|
|
2240
|
+
//# sourceMappingURL=chunk-6JPFYXEU.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-ZVEEWGDK.js";
|
|
7
7
|
import {
|
|
8
8
|
persistedPartToInteraction
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M3K2HVQD.js";
|
|
10
10
|
import {
|
|
11
11
|
persistedPartToPlan,
|
|
12
12
|
planToPersistedPart
|
|
@@ -155,4 +155,4 @@ export {
|
|
|
155
155
|
buildAttachmentPromptBlock,
|
|
156
156
|
historyContentWithAttachments
|
|
157
157
|
};
|
|
158
|
-
//# sourceMappingURL=chunk-
|
|
158
|
+
//# sourceMappingURL=chunk-B2UEW62O.js.map
|
|
@@ -76,7 +76,7 @@ function parseInteractionRequest(data) {
|
|
|
76
76
|
if (!validation.success) {
|
|
77
77
|
return { succeeded: false, error: `malformed interaction request: ${validation.error.message}` };
|
|
78
78
|
}
|
|
79
|
-
return { succeeded: true, value:
|
|
79
|
+
return { succeeded: true, value: validation.data };
|
|
80
80
|
}
|
|
81
81
|
function parseInteractionCancel(data) {
|
|
82
82
|
const id = typeof data?.id === "string" && data.id ? data.id : null;
|
|
@@ -195,4 +195,4 @@ export {
|
|
|
195
195
|
stampInteractionAnswers,
|
|
196
196
|
persistedPartToInteraction
|
|
197
197
|
};
|
|
198
|
-
//# sourceMappingURL=chunk-
|
|
198
|
+
//# sourceMappingURL=chunk-M3K2HVQD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/interactions/contract.ts"],"sourcesContent":["// Shared contract for agent interaction events (kind: \"question\" et al) — the\n// generalized human-in-the-loop primitive on the chat stream. Framework-agnostic\n// (no server- or React-only imports) so a producer (chat route) and a consumer\n// (stream parser, transcript, question card) agree on one wire shape and one\n// persisted-part shape.\n//\n// An `interaction` event means the run is BLOCKED inside the sidecar's\n// InteractionBroker until the user answers, the agent withdraws the ask\n// (`interaction.cancel`), or the broker times out. A pending interaction is\n// \"waiting on the user\", not \"model working\".\n\nimport {\n InteractionRequestSchema,\n type InteractionData,\n type InteractionField,\n type InteractionOutcome,\n type InteractionRequest,\n} from '@tangle-network/agent-interface'\n\nexport type { InteractionData, InteractionOutcome, InteractionRequest }\n\n// ---------------------------------------------------------------------------\n// Event names\n\n/** Sidecar → client: the agent raised an ask; data = `{ request }`. */\nexport const INTERACTION_EVENT = 'interaction' as const\n/** Sidecar → client: the ask was withdrawn; data = `{ id, reason? }`. */\nexport const INTERACTION_CANCEL_EVENT = 'interaction.cancel' as const\n/** An ask was answered; data = `{ id, status }`. In the wire contract so a\n * server broadcast and a client-local mark share one event name. */\nexport const INTERACTION_RESOLVED_EVENT = 'interaction.resolved' as const\n\n/** Interaction kinds a product typically renders a card for. Anything else is\n * auto-declined by the chat producer's safety net and never reaches a client.\n * A pure default; a product may substitute its own renderable set. */\nconst RENDERABLE_INTERACTION_KINDS: ReadonlySet<string> = new Set(['question', 'plan'])\n\n/** Resolve if the given interaction kind is renderable within the application context */\nexport function isRenderableInteractionKind(kind: string): boolean {\n return RENDERABLE_INTERACTION_KINDS.has(kind)\n}\n\n/** Answer/field keys the sidecar will accept: identifier-safe and never a\n * prototype-pollution vector. */\nexport function isSafeInteractionFieldKey(key: string): boolean {\n return /^[A-Za-z0-9_-]+$/.test(key) && key !== '__proto__' && key !== 'constructor' && key !== 'prototype'\n}\n\n// ---------------------------------------------------------------------------\n// Field types — aliases of the shared Interface contract. The app owns how the\n// fields render, not a second wire shape.\n\n/** Extract select-type interaction fields and optionally allow custom values */\nexport type ChatSelectField = Extract<InteractionField, { type: 'select' }>\n\n/**\n * A field the user types free text into, which may declare the longest answer\n * its answer route will accept — so a card can stop the typing rather than let\n * the route reject it.\n *\n * Both `text` and `secret`, which is why this is not `ChatTextField`: unlike\n * `ChatSelectField`, it does not name a single `type` literal. They render\n * differently (a textarea vs a password input) and are grouped only by the one\n * property that matters here — an answer whose length can run past what the\n * route takes.\n *\n * The request author chooses this value; omission means the shared contract\n * imposes no length limit.\n */\nexport type ChatFreeTextField = Extract<InteractionField, { type: 'text' | 'secret' }>\n\n/** The shared field contract under the UI-facing name used by this package. */\nexport type ChatInteractionField = InteractionField\n\n/** The shared request contract under the wire-facing name used by this package. */\nexport type InteractionRequestWire = InteractionRequest\n\n// ---------------------------------------------------------------------------\n// Interaction lifecycle\n\n/** Define possible statuses representing the state of a chat interaction */\nexport type ChatInteractionStatus = 'pending' | 'answered' | 'declined' | 'cancelled' | 'expired'\n\n/** Accepted field selections keyed by answer-spec field name. */\n/** Accepted answer values. Select fields historically used `string[]`; the\n * wider scalar union is additive and lets durable stores preserve text,\n * numeric, and boolean answer fields without coercion. */\nexport type InteractionAnswerValue = string | number | boolean | string[]\n/** Map interaction identifiers to their corresponding answer values */\nexport type InteractionAnswers = Record<string, InteractionAnswerValue>\n\n/** Resolve the result of parsing interaction answers with success status and corresponding data or error message */\nexport type ParseInteractionAnswersResult =\n | { succeeded: true; value: InteractionAnswers }\n | { succeeded: false; error: string }\n\n/** Strictly validates and copies persisted answer selections. */\nexport function parseInteractionAnswers(value: unknown): ParseInteractionAnswersResult {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return { succeeded: false, error: 'interaction answers must be an object' }\n }\n const answers: InteractionAnswers = {}\n for (const [key, selection] of Object.entries(value as Record<string, unknown>)) {\n if (!isSafeInteractionFieldKey(key)) {\n return { succeeded: false, error: `interaction answers contain an unsafe field key: ${key}` }\n }\n const valid = typeof selection === 'string' || typeof selection === 'number' || typeof selection === 'boolean' ||\n (Array.isArray(selection) && selection.every((item) => typeof item === 'string'))\n if (!valid) {\n return { succeeded: false, error: `interaction answer ${key} must be a string, number, boolean, or string array` }\n }\n answers[key] = Array.isArray(selection) ? [...selection] : selection\n }\n return { succeeded: true, value: answers }\n}\n\n/** The client/persisted view of one ask. `fields` come verbatim off the wire. */\nexport interface ChatInteraction {\n id: string\n kind: string\n title: string\n body?: string\n fields: ChatInteractionField[]\n status: ChatInteractionStatus\n /** Accepted selections, restored with the transcript after reload. */\n answers?: InteractionAnswers\n /** Set when status came from an `interaction.cancel` (e.g. \"timeout\"). */\n cancelReason?: string\n}\n\n/** Resolve if the interaction status is a terminal state excluding pending */\nexport function isTerminalInteractionStatus(status: ChatInteractionStatus): boolean {\n return status !== 'pending'\n}\n\n/** Statuses only move forward (pending → terminal); a replayed/stale `pending`\n * must never resurrect a resolved card. */\nexport function canTransitionInteractionStatus(\n from: ChatInteractionStatus,\n to: ChatInteractionStatus,\n): boolean {\n return from === 'pending' && to !== from\n}\n\n/** Maps an `interaction.cancel` reason to the card's terminal status. */\nexport function cancelStatusFor(reason: string | undefined): ChatInteractionStatus {\n return reason === 'timeout' ? 'expired' : 'cancelled'\n}\n\nfunction stableValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(stableValue)\n if (!value || typeof value !== 'object') return value\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([key, nested]) => [key, stableValue(nested)]),\n )\n}\n\nfunction normalizedInteractionText(value: string | undefined): string {\n return (value ?? '').replace(/\\s+/g, ' ').trim()\n}\n\n/** Content identity for duplicate safety nets. Excludes volatile ids/statuses. */\nexport function questionInteractionContentSignature(interaction: ChatInteraction): string | null {\n if (interaction.kind !== 'question') return null\n return JSON.stringify(stableValue({\n kind: interaction.kind,\n title: normalizedInteractionText(interaction.title),\n body: normalizedInteractionText(interaction.body),\n fields: interaction.fields,\n }))\n}\n\n/** Remove duplicate question interactions based on their content signature to ensure uniqueness */\nexport function dedupeQuestionInteractionsByContent(interactions: ChatInteraction[]): ChatInteraction[] {\n const seen = new Set<string>()\n return interactions.filter((interaction) => {\n const signature = questionInteractionContentSignature(interaction)\n if (!signature) return true\n if (seen.has(signature)) return false\n seen.add(signature)\n return true\n })\n}\n\n// ---------------------------------------------------------------------------\n// Wire parsing — typed outcomes, fail loud at the caller (log + skip; never a\n// half-rendered card).\n\n/** Resolve interaction parsing outcome as success with value or failure with error message */\nexport type ParseInteractionResult =\n | { succeeded: true; value: InteractionRequestWire }\n | { succeeded: false; error: string }\n\n/** Parses an `interaction` event's data (`{ request }`) with the shared schema. */\nexport function parseInteractionRequest(data: Record<string, unknown> | undefined): ParseInteractionResult {\n const request = data?.request\n if (!request || typeof request !== 'object') {\n return { succeeded: false, error: 'interaction event carried no request object' }\n }\n const validation = InteractionRequestSchema.safeParse(request)\n if (!validation.success) {\n return { succeeded: false, error: `malformed interaction request: ${validation.error.message}` }\n }\n return { succeeded: true, value: validation.data }\n}\n\n/** Describe data required to cancel an interaction including its identifier and optional reason */\nexport interface InteractionCancelData {\n id: string\n reason?: string\n}\n\n/** Parse interaction cancel data and return success status with parsed value or error message */\nexport function parseInteractionCancel(\n data: Record<string, unknown> | undefined,\n): { succeeded: true; value: InteractionCancelData } | { succeeded: false; error: string } {\n const id = typeof data?.id === 'string' && data.id ? data.id : null\n if (!id) return { succeeded: false, error: 'interaction.cancel event carried no id' }\n const reason = typeof data?.reason === 'string' && data.reason ? data.reason : undefined\n return { succeeded: true, value: { id, ...(reason ? { reason } : {}) } }\n}\n\n// ---------------------------------------------------------------------------\n// Composer-as-answer delivery: while asks are pending the composer never\n// blocks — typed text is delivered verbatim to every open ask and the agent\n// decides what it means. No interpretation here; the sidecar validates answers\n// fail-closed (invalid free text on an option-only ask → 400).\n\n/** Determine if a chat interaction field allows free text input */\nexport function fieldAcceptsFreeText(field: ChatInteractionField): boolean {\n if (field.type === 'text') return true\n if (field.type === 'select') return (field as ChatSelectField).allowCustom === true\n return false\n}\n\n/** Define the structure for delivering answers linked to a specific chat interaction and field */\nexport interface ComposerAnswerDelivery {\n interactionId: string\n field: ChatInteractionField\n}\n\n/** One delivery per pending ask: the first free-text-capable field, else the\n * first field. Zero-field asks are skipped (nothing to carry the text). */\nexport function composerAnswerDeliveries(pending: ChatInteraction[]): ComposerAnswerDelivery[] {\n const deliveries: ComposerAnswerDelivery[] = []\n for (const interaction of pending) {\n // Only questions take a composer-routed answer. A non-question ask (a plan)\n // is POSTed as outcome:\"accepted\" when answered — routing composer text to\n // it would silently APPROVE it. Approval is an explicit card click, so the\n // composer skips it and the plan card stays the only path.\n if (interaction.kind !== 'question') continue\n const field = interaction.fields.find(fieldAcceptsFreeText) ?? interaction.fields[0]\n if (!field) continue\n deliveries.push({ interactionId: interaction.id, field })\n }\n return deliveries\n}\n\n/** Shapes composer text into the respond payload for the routed field\n * (select answers are string arrays on the wire; text answers are strings). */\nexport function composerAnswerData(field: ChatInteractionField, text: string): InteractionData {\n return { [field.name]: field.type === 'select' ? [text] : text }\n}\n\n// ---------------------------------------------------------------------------\n// Part keys + codecs (persisted `messages.parts` entries and live stream parts\n// share these shapes).\n\n/** Generate a unique key string for an interaction using the given identifier */\nexport function interactionPartKey(id: string): string {\n return `interaction:${id}`\n}\n\n/** Generate a unique key string for a notice using the given identifier */\nexport function noticePartKey(id: string): string {\n return `notice:${id}`\n}\n\n/** Define specific string literals representing different kinds of notices */\nexport type NoticeKind = 'warning' | 'auto-declined'\n\n/**\n * Persisted-part shapes the codecs below produce — the SAME rows\n * `/chat-store`'s `ChatInteractionPart`/`ChatNoticePart` store, typed at the\n * source so a product pushing them into a `ChatMessagePart[]` transcript needs\n * no cast. Type aliases (not interfaces) on purpose: the implicit index\n * signature keeps them assignable to the `Record<string, unknown>` these\n * codecs previously returned, so existing consumers stay source-compatible.\n */\nexport type InteractionPersistedPart = {\n type: 'interaction'\n id: string\n kind: string\n title: string\n body?: string\n answerSpec: { fields: ChatInteractionField[] }\n status: ChatInteractionStatus\n answers?: InteractionAnswers\n cancelReason?: string\n}\n\n/** Define a persisted notice part with type, id, kind, and text properties */\nexport type NoticePersistedPart = {\n type: 'notice'\n id: string\n noticeKind: NoticeKind\n text: string\n}\n\n/** Builds the persisted/streamed `notice` part — a one-line transcript notice\n * explaining an out-of-band event (warning, auto-declined interaction). */\nexport function noticePart(noticeKind: NoticeKind, id: string, text: string): NoticePersistedPart {\n return { type: 'notice', id, noticeKind, text }\n}\n\n/** Reads a wire request into the client's pending `ChatInteraction`. */\nexport function interactionFromWireRequest(request: InteractionRequestWire): ChatInteraction {\n return {\n id: request.id,\n kind: request.kind,\n title: request.title,\n ...(request.body ? { body: request.body } : {}),\n fields: request.answerSpec.fields,\n status: 'pending',\n }\n}\n\n/** Builds the persisted/streamed `interaction` part from a wire request. */\nexport function interactionToPersistedPart(\n request: InteractionRequestWire,\n status: ChatInteractionStatus,\n cancelReason?: string,\n answers?: InteractionAnswers,\n): InteractionPersistedPart {\n const parsedAnswers = answers === undefined ? undefined : parseInteractionAnswers(answers)\n if (parsedAnswers && !parsedAnswers.succeeded) throw new TypeError(parsedAnswers.error)\n return {\n type: 'interaction',\n id: request.id,\n kind: request.kind,\n title: request.title,\n ...(request.body ? { body: request.body } : {}),\n answerSpec: { fields: request.answerSpec.fields },\n status,\n ...(parsedAnswers?.succeeded ? { answers: parsedAnswers.value } : {}),\n ...(cancelReason ? { cancelReason } : {}),\n }\n}\n\n/** Stamps accepted values onto matching persisted interaction parts without\n * mutating the caller's transcript or answer maps. */\nexport function stampInteractionAnswers(\n parts: Array<Record<string, unknown>>,\n answersByInteractionId: Readonly<Record<string, InteractionAnswers>>,\n): Array<Record<string, unknown>> {\n return parts.map((part) => {\n if (String(part.type ?? '') !== 'interaction' || typeof part.id !== 'string') return part\n if (!Object.prototype.hasOwnProperty.call(answersByInteractionId, part.id)) return part\n const rawAnswers = answersByInteractionId[part.id]\n if (rawAnswers === undefined) return part\n const parsed = parseInteractionAnswers(rawAnswers)\n if (!parsed.succeeded) throw new TypeError(parsed.error)\n return { ...part, answers: parsed.value }\n })\n}\n\n/** Reads a persisted/streamed `interaction` part back into a `ChatInteraction`.\n * Returns null (caller logs) when the part is not one of ours. */\nexport function persistedPartToInteraction(part: Record<string, unknown>): ChatInteraction | null {\n if (String(part.type ?? '') !== 'interaction') return null\n const id = typeof part.id === 'string' && part.id ? part.id : null\n const kind = typeof part.kind === 'string' && part.kind ? part.kind : null\n const title = typeof part.title === 'string' ? part.title : ''\n const answerSpec = part.answerSpec as { fields?: unknown } | undefined\n const fields = Array.isArray(answerSpec?.fields) ? (answerSpec.fields as ChatInteractionField[]) : null\n const status = part.status as ChatInteractionStatus | undefined\n const validStatus = status && ['pending', 'answered', 'declined', 'cancelled', 'expired'].includes(status)\n const parsedAnswers = part.answers === undefined ? undefined : parseInteractionAnswers(part.answers)\n if (!id || !kind || !fields || !validStatus || (parsedAnswers && !parsedAnswers.succeeded)) return null\n return {\n id,\n kind,\n title,\n ...(typeof part.body === 'string' && part.body ? { body: part.body } : {}),\n fields,\n status,\n ...(parsedAnswers?.succeeded ? { answers: parsedAnswers.value } : {}),\n ...(typeof part.cancelReason === 'string' && part.cancelReason ? { cancelReason: part.cancelReason } : {}),\n }\n}\n"],"mappings":";AAWA;AAAA,EACE;AAAA,OAKK;AAQA,IAAM,oBAAoB;AAE1B,IAAM,2BAA2B;AAGjC,IAAM,6BAA6B;AAK1C,IAAM,+BAAoD,oBAAI,IAAI,CAAC,YAAY,MAAM,CAAC;AAG/E,SAAS,4BAA4B,MAAuB;AACjE,SAAO,6BAA6B,IAAI,IAAI;AAC9C;A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M,aAAa,KAAK;AACxB,QAAM,SAAS,MAAM,QAAQ,YAAY,MAAM,IAAK,WAAW,SAAoC;AACnG,QAAM,SAAS,KAAK;AACpB,QAAM,cAAc,UAAU,CAAC,WAAW,YAAY,YAAY,aAAa,SAAS,EAAE,SAAS,MAAM;AACzG,QAAM,gBAAgB,KAAK,YAAY,SAAY,SAAY,wBAAwB,KAAK,OAAO;AACnG,MAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAgB,iBAAiB,CAAC,cAAc,UAAY,QAAO;AACnG,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,OAAO,KAAK,SAAS,YAAY,KAAK,OAAO,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC;AAAA,IACxE;AAAA,IACA;AAAA,IACA,GAAI,eAAe,YAAY,EAAE,SAAS,cAAc,MAAM,IAAI,CAAC;AAAA,IACnE,GAAI,OAAO,KAAK,iBAAiB,YAAY,KAAK,eAAe,EAAE,cAAc,KAAK,aAAa,IAAI,CAAC;AAAA,EAC1G;AACF;","names":[]}
|
|
@@ -8,13 +8,11 @@ import {
|
|
|
8
8
|
snapModelToHarness as aiSnapModelToHarness
|
|
9
9
|
} from "@tangle-network/agent-interface";
|
|
10
10
|
var NON_BACKEND_HARNESSES = ["gemini"];
|
|
11
|
-
var EXTRA_HARNESSES = ["forge", "cursor"];
|
|
12
11
|
var nonBackendHarnesses = new Set(NON_BACKEND_HARNESSES);
|
|
13
12
|
var KNOWN_HARNESSES = [
|
|
14
13
|
...harnessTypeSchema.options.filter(
|
|
15
14
|
(harness) => !nonBackendHarnesses.has(harness)
|
|
16
|
-
)
|
|
17
|
-
...EXTRA_HARNESSES
|
|
15
|
+
)
|
|
18
16
|
];
|
|
19
17
|
var DEFAULT_HARNESS = "opencode";
|
|
20
18
|
var HARNESS_SET = new Set(KNOWN_HARNESSES);
|
|
@@ -34,24 +32,14 @@ function resolveSessionHarness(input = {}) {
|
|
|
34
32
|
const harness = coerceHarness(input.requested, coerceHarness(input.workspaceDefault, fallback));
|
|
35
33
|
return { harness, locked: false, swapAttempted: false };
|
|
36
34
|
}
|
|
37
|
-
var canonicalHarnesses = new Set(harnessTypeSchema.options);
|
|
38
|
-
function canonicalHarness(harness) {
|
|
39
|
-
return canonicalHarnesses.has(harness) ? harness : null;
|
|
40
|
-
}
|
|
41
35
|
function isModelCompatibleWithHarness(harness, modelId) {
|
|
42
|
-
|
|
43
|
-
if (!canonical) return true;
|
|
44
|
-
return harnessSupportsModel(canonical, modelId);
|
|
36
|
+
return harnessSupportsModel(harness, modelId);
|
|
45
37
|
}
|
|
46
38
|
function snapModelToHarness(harness, modelId, canonicalIds) {
|
|
47
|
-
|
|
48
|
-
if (!canonical) return modelId;
|
|
49
|
-
return aiSnapModelToHarness(canonical, modelId, canonicalIds);
|
|
39
|
+
return aiSnapModelToHarness(harness, modelId, canonicalIds);
|
|
50
40
|
}
|
|
51
41
|
function snapHarnessToModel(harness, modelId) {
|
|
52
|
-
const
|
|
53
|
-
if (!canonical) return harness;
|
|
54
|
-
const snapped = aiSnapHarnessToModel(canonical, modelId);
|
|
42
|
+
const snapped = aiSnapHarnessToModel(harness, modelId);
|
|
55
43
|
if (!isHarness(snapped)) {
|
|
56
44
|
throw new Error(
|
|
57
45
|
`Harness "${harness}" snapped to "${snapped}" for model "${modelId}", which this platform has no backend for.`
|
|
@@ -81,4 +69,4 @@ export {
|
|
|
81
69
|
snapHarnessToModel,
|
|
82
70
|
assertHarnessModelCompatible
|
|
83
71
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-TH7L265V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/harness/index.ts"],"sourcesContent":["/**\n * Coding-agent harness selection — taxonomy, coercion, and the session-lock invariant.\n *\n * A \"harness\" is the coding-agent CLI a sandbox drives (opencode / codex /\n * claude-code / …). The shell governs WHICH harness a chat session uses and\n * enforces that a session is LOCKED to the harness it started with — the model\n * may change mid-session, the harness may not (swapping it mid-session would\n * orphan the session's running agent state). Every product otherwise hand-rolls\n * this and hard-codes a single harness; this is the one place the rule lives.\n *\n * Substrate-free: the harness list is derived from `@tangle-network/agent-interface`'s canonical\n * harness enum and mirrors the sandbox SDK's `BackendType` (no sandbox dependency). The consumer\n * owns storage — which harness a workspace defaults to, which one a session locked — and maps the\n * resolved value onto the SDK's `backend.type`.\n *\n * Harness↔model COMPATIBILITY (which models a harness can run, snapping) is NOT defined here — it\n * comes from `@tangle-network/agent-interface`, the single source of truth shared with the\n * sandbox-ui pickers and the cli-bridge backends. This module owns the harness TAXONOMY + the\n * session lock.\n */\n\nimport {\n harnessSupportsModel,\n harnessTypeSchema,\n modelProvider,\n preferredHarnessForModel,\n snapHarnessToModel as aiSnapHarnessToModel,\n snapModelToHarness as aiSnapModelToHarness,\n type HarnessType,\n} from '@tangle-network/agent-interface'\n\n/**\n * Canonical harnesses that are NOT sandbox backends. Each value in `KNOWN_HARNESSES` is dispatched\n * as `backend.type`, so a harness the platform ships no provider adapter for must stay out —\n * offering it would resolve a session onto a runner that cannot start.\n */\nconst NON_BACKEND_HARNESSES = ['gemini'] as const satisfies readonly HarnessType[]\n\nconst nonBackendHarnesses = new Set<string>(NON_BACKEND_HARNESSES)\n\n/** A coding-agent backend this shell can dispatch a session onto. */\nexport type Harness = Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]>\n\n/**\n * The known coding-agent backends: the canonical harness set minus what has no provider adapter,\n * Derived from `harnessTypeSchema.options` so a harness added upstream reaches this shell without\n * an edit here, and kept structural so this module still needs no sandbox dependency.\n */\nexport const KNOWN_HARNESSES: readonly Harness[] = [\n ...harnessTypeSchema.options.filter(\n (harness): harness is Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]> =>\n !nonBackendHarnesses.has(harness),\n ),\n]\n\n/** Define the default harness to use for code execution and testing environments */\nexport const DEFAULT_HARNESS: Harness = 'opencode'\n\nconst HARNESS_SET: ReadonlySet<string> = new Set(KNOWN_HARNESSES)\n\n/** Determine if a value is a recognized harness string identifier */\nexport function isHarness(value: unknown): value is Harness {\n return typeof value === 'string' && HARNESS_SET.has(value)\n}\n\n/** Coerce an arbitrary value to a known harness, falling back (default `opencode`). */\nexport function coerceHarness(value: unknown, fallback: Harness = DEFAULT_HARNESS): Harness {\n return isHarness(value) ? value : fallback\n}\n\n/** Resolve input options to determine the appropriate session harness to use */\nexport interface ResolveSessionHarnessInput {\n /** The harness already locked to this session (recorded at its first turn). */\n sessionHarness?: unknown\n /** The harness requested now — a new session's choice, or a turn's attempt to switch. */\n requested?: unknown\n /** The workspace's default harness, used only when starting a fresh session. */\n workspaceDefault?: unknown\n /** Final fallback when nothing else resolves (default `opencode`). */\n fallback?: Harness\n}\n\n/** Represent resolved session state including harness, lock status, and swap attempt flag */\nexport interface ResolvedSessionHarness {\n /** The harness to actually run — the locked one when the session already has it. */\n harness: Harness\n /** True when the session already had a locked harness (this turn did not pick it). */\n locked: boolean\n /** True when `requested` differs from the locked harness — a forbidden mid-session\n * swap the caller should reject or warn on. The lock always wins regardless. */\n swapAttempted: boolean\n}\n\n/**\n * Resolve the harness for a turn, enforcing the session lock.\n *\n * - **Session already started** (`sessionHarness` is a known harness): that harness\n * wins (`locked: true`); a differing `requested` sets `swapAttempted` so the caller\n * can reject the swap. The model is a separate per-turn concern and is unaffected.\n * - **Fresh session**: pick `requested → workspaceDefault → fallback`. The caller\n * persists the result as the session's lock for every subsequent turn.\n */\nexport function resolveSessionHarness(input: ResolveSessionHarnessInput = {}): ResolvedSessionHarness {\n const fallback = input.fallback ?? DEFAULT_HARNESS\n if (isHarness(input.sessionHarness)) {\n const locked = input.sessionHarness\n const swapAttempted = isHarness(input.requested) && input.requested !== locked\n return { harness: locked, locked: true, swapAttempted }\n }\n const harness = coerceHarness(input.requested, coerceHarness(input.workspaceDefault, fallback))\n return { harness, locked: false, swapAttempted: false }\n}\n\n/**\n * Harness ↔ model compatibility + snapping — delegated to `@tangle-network/agent-interface`.\n *\n * `Harness` is the dispatchable subset of `HarnessType`: this shell drops only canonical harnesses\n * for which the platform has no backend. Compatibility therefore comes entirely from Interface;\n * this package keeps no second harness taxonomy.\n */\n\nexport { modelProvider }\n\n/** Provider-less ids (sentinels like \"default\", or a session's own config) are\n * compatible everywhere — every harness honors its own configuration. */\nexport function isModelCompatibleWithHarness(harness: Harness, modelId: string): boolean {\n return harnessSupportsModel(harness, modelId)\n}\n\n/** Keep `modelId` when the harness can run it; else the harness's best compatible\n * catalog id (preferred patterns in order, highest version). When nothing in the\n * catalog fits, return the original so the caller sees the incompatibility. */\nexport function snapModelToHarness(harness: Harness, modelId: string, canonicalIds: readonly string[]): string {\n return aiSnapModelToHarness(harness, modelId, canonicalIds)\n}\n\n/** Keep the harness when it can run `modelId`; else the model's native harness\n * (anthropic → claude-code, openai → codex, moonshot → kimi-code), falling back to opencode. */\nexport function snapHarnessToModel(harness: Harness, modelId: string): Harness {\n const snapped = aiSnapHarnessToModel(harness, modelId)\n if (!isHarness(snapped)) {\n throw new Error(\n `Harness \"${harness}\" snapped to \"${snapped}\" for model \"${modelId}\", which this platform has no backend for.`,\n )\n }\n return snapped\n}\n\n/** Fail-loud server guard: throw when a harness is asked to run a model it can't.\n * Call before dispatching a sandbox turn so a bypassed UI can't reach the sidecar\n * with an incompatible pair. */\nexport function assertHarnessModelCompatible(harness: Harness, modelId: string): void {\n if (!isModelCompatibleWithHarness(harness, modelId)) {\n const provider = modelProvider(modelId)\n const native = preferredHarnessForModel(modelId)\n throw new Error(\n `Harness \"${harness}\" cannot run model \"${modelId}\" (provider \"${provider}\"). ` +\n `Use ${native ?? 'a router-backed harness (opencode)'} or an allowed model.`,\n )\n }\n}\n"],"mappings":";AAqBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,OAEjB;AAOP,IAAM,wBAAwB,CAAC,QAAQ;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nD,UAAM,WAAW,cAAc,OAAO;AACtC,UAAM,SAAS,yBAAyB,OAAO;AAC/C,UAAM,IAAI;AAAA,MACR,YAAY,OAAO,uBAAuB,OAAO,gBAAgB,QAAQ,WAChE,UAAU,oCAAoC;AAAA,IACzD;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canTransitionInteractionStatus,
|
|
3
3
|
persistedPartToInteraction
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-M3K2HVQD.js";
|
|
5
5
|
import {
|
|
6
6
|
canTransitionPlanStatus,
|
|
7
7
|
persistedPartToPlan,
|
|
@@ -380,4 +380,4 @@ export {
|
|
|
380
380
|
terminalizeDanglingAssistantToolUpdates,
|
|
381
381
|
encodeEvent
|
|
382
382
|
};
|
|
383
|
-
//# sourceMappingURL=chunk-
|
|
383
|
+
//# sourceMappingURL=chunk-XZ27ENOZ.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
interactionFromWireRequest,
|
|
3
3
|
isSafeInteractionFieldKey,
|
|
4
4
|
questionInteractionContentSignature
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-M3K2HVQD.js";
|
|
6
6
|
|
|
7
7
|
// src/interactions/sidecar.ts
|
|
8
8
|
var DEFAULT_TIMEOUT_MS = 5e3;
|
|
@@ -395,4 +395,4 @@ export {
|
|
|
395
395
|
mapInteractionRespondFailure,
|
|
396
396
|
createInteractionAnswerRoute
|
|
397
397
|
};
|
|
398
|
-
//# sourceMappingURL=chunk-
|
|
398
|
+
//# sourceMappingURL=chunk-ZSSCVT6H.js.map
|
|
@@ -15,9 +15,7 @@ declare function isSafeInteractionFieldKey(key: string): boolean;
|
|
|
15
15
|
/** Extract select-type interaction fields and optionally allow custom values */
|
|
16
16
|
type ChatSelectField = Extract<InteractionField, {
|
|
17
17
|
type: 'select';
|
|
18
|
-
}
|
|
19
|
-
allowCustom?: boolean;
|
|
20
|
-
};
|
|
18
|
+
}>;
|
|
21
19
|
/**
|
|
22
20
|
* A field the user types free text into, which may declare the longest answer
|
|
23
21
|
* its answer route will accept — so a card can stop the typing rather than let
|
|
@@ -29,30 +27,16 @@ type ChatSelectField = Extract<InteractionField, {
|
|
|
29
27
|
* property that matters here — an answer whose length can run past what the
|
|
30
28
|
* route takes.
|
|
31
29
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* returns the raw payload. A product that SYNTHESISES an interaction (rather than
|
|
35
|
-
* parsing one off the wire) sets it directly from whatever bound its own route
|
|
36
|
-
* validates against.
|
|
30
|
+
* The request author chooses this value; omission means the shared contract
|
|
31
|
+
* imposes no length limit.
|
|
37
32
|
*/
|
|
38
33
|
type ChatFreeTextField = Extract<InteractionField, {
|
|
39
34
|
type: 'text' | 'secret';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
* other kind passes through unchanged. */
|
|
46
|
-
type ChatInteractionField = Exclude<InteractionField, {
|
|
47
|
-
type: 'select' | 'text' | 'secret';
|
|
48
|
-
}> | ChatSelectField | ChatFreeTextField;
|
|
49
|
-
/** `InteractionRequest` whose fields carry those widenings — a select that may
|
|
50
|
-
* grant `allowCustom`, a free-text field that may declare `maxLength`. */
|
|
51
|
-
type InteractionRequestWire = Omit<InteractionRequest, 'answerSpec'> & {
|
|
52
|
-
answerSpec: {
|
|
53
|
-
fields: ChatInteractionField[];
|
|
54
|
-
};
|
|
55
|
-
};
|
|
35
|
+
}>;
|
|
36
|
+
/** The shared field contract under the UI-facing name used by this package. */
|
|
37
|
+
type ChatInteractionField = InteractionField;
|
|
38
|
+
/** The shared request contract under the wire-facing name used by this package. */
|
|
39
|
+
type InteractionRequestWire = InteractionRequest;
|
|
56
40
|
/** Define possible statuses representing the state of a chat interaction */
|
|
57
41
|
type ChatInteractionStatus = 'pending' | 'answered' | 'declined' | 'cancelled' | 'expired';
|
|
58
42
|
/** Accepted field selections keyed by answer-spec field name. */
|
|
@@ -104,9 +88,7 @@ type ParseInteractionResult = {
|
|
|
104
88
|
succeeded: false;
|
|
105
89
|
error: string;
|
|
106
90
|
};
|
|
107
|
-
/** Parses an `interaction` event's data (`{ request }`)
|
|
108
|
-
* with the agent-interface schema but returns the raw request so a field a
|
|
109
|
-
* pinned schema predates (`allowCustom`) survives. */
|
|
91
|
+
/** Parses an `interaction` event's data (`{ request }`) with the shared schema. */
|
|
110
92
|
declare function parseInteractionRequest(data: Record<string, unknown> | undefined): ParseInteractionResult;
|
|
111
93
|
/** Describe data required to cancel an interaction including its identifier and optional reason */
|
|
112
94
|
interface InteractionCancelData {
|
|
@@ -43,10 +43,6 @@ import {
|
|
|
43
43
|
selectTickStep
|
|
44
44
|
} from "../chunk-KPRBFNGT.js";
|
|
45
45
|
import "../chunk-TZO3SOUL.js";
|
|
46
|
-
import {
|
|
47
|
-
DesignCanvasChromeLazy,
|
|
48
|
-
DesignCanvasLazy
|
|
49
|
-
} from "../chunk-OO4DROKM.js";
|
|
50
46
|
import "../chunk-ZN5J47UX.js";
|
|
51
47
|
import {
|
|
52
48
|
DEFAULT_INSERT_TEMPLATES,
|
|
@@ -87,6 +83,10 @@ import {
|
|
|
87
83
|
setPagePropsCommand,
|
|
88
84
|
ungroupElementCommand
|
|
89
85
|
} from "../chunk-O22STZ3P.js";
|
|
86
|
+
import {
|
|
87
|
+
DesignCanvasChromeLazy,
|
|
88
|
+
DesignCanvasLazy
|
|
89
|
+
} from "../chunk-OO4DROKM.js";
|
|
90
90
|
import {
|
|
91
91
|
assertSceneMediaSrc,
|
|
92
92
|
bleedAwareExportBounds,
|
package/dist/harness/index.d.ts
CHANGED
|
@@ -23,24 +23,17 @@ export { modelProvider } from '@tangle-network/agent-interface';
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Canonical harnesses that are NOT sandbox backends. `KNOWN_HARNESSES` is dispatched
|
|
27
|
-
* `backend.type`, so a harness the platform ships no provider adapter for must stay out —
|
|
26
|
+
* Canonical harnesses that are NOT sandbox backends. Each value in `KNOWN_HARNESSES` is dispatched
|
|
27
|
+
* as `backend.type`, so a harness the platform ships no provider adapter for must stay out —
|
|
28
28
|
* offering it would resolve a session onto a runner that cannot start.
|
|
29
29
|
*/
|
|
30
30
|
declare const NON_BACKEND_HARNESSES: readonly ["gemini"];
|
|
31
|
-
/**
|
|
32
|
-
* Backends the platform runs that the canonical enum does not carry yet. The guard below turns
|
|
33
|
-
* their adoption upstream into a compile error, so this list is emptied rather than duplicating a
|
|
34
|
-
* canonical id.
|
|
35
|
-
*/
|
|
36
|
-
declare const EXTRA_HARNESSES: readonly ["forge", "cursor"];
|
|
37
31
|
/** A coding-agent backend this shell can dispatch a session onto. */
|
|
38
|
-
type Harness = Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]
|
|
32
|
+
type Harness = Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]>;
|
|
39
33
|
/**
|
|
40
34
|
* The known coding-agent backends: the canonical harness set minus what has no provider adapter,
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* module still needs no sandbox dependency.
|
|
35
|
+
* Derived from `harnessTypeSchema.options` so a harness added upstream reaches this shell without
|
|
36
|
+
* an edit here, and kept structural so this module still needs no sandbox dependency.
|
|
44
37
|
*/
|
|
45
38
|
declare const KNOWN_HARNESSES: readonly Harness[];
|
|
46
39
|
/** Define the default harness to use for code execution and testing environments */
|
package/dist/harness/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as InteractionRequestWire } from '../contract-
|
|
2
|
-
export { f as ChatFreeTextField, b as ChatInteraction, C as ChatInteractionField, a as ChatInteractionStatus, d as ChatSelectField, g as ComposerAnswerDelivery, h as INTERACTION_CANCEL_EVENT, i as INTERACTION_EVENT, j as INTERACTION_RESOLVED_EVENT, k as InteractionAnswerValue, I as InteractionAnswers, c as InteractionCancelData, l as InteractionPersistedPart, N as NoticeKind, m as NoticePersistedPart, P as ParseInteractionAnswersResult, n as ParseInteractionResult, o as canTransitionInteractionStatus, p as cancelStatusFor, q as composerAnswerData, r as composerAnswerDeliveries, s as dedupeQuestionInteractionsByContent, t as fieldAcceptsFreeText, u as interactionFromWireRequest, v as interactionPartKey, w as interactionToPersistedPart, x as isRenderableInteractionKind, y as isSafeInteractionFieldKey, z as isTerminalInteractionStatus, A as noticePart, B as noticePartKey, D as parseInteractionAnswers, E as parseInteractionCancel, F as parseInteractionRequest, G as persistedPartToInteraction, H as questionInteractionContentSignature, J as stampInteractionAnswers } from '../contract-
|
|
1
|
+
import { e as InteractionRequestWire } from '../contract-OxG_jVMx.js';
|
|
2
|
+
export { f as ChatFreeTextField, b as ChatInteraction, C as ChatInteractionField, a as ChatInteractionStatus, d as ChatSelectField, g as ComposerAnswerDelivery, h as INTERACTION_CANCEL_EVENT, i as INTERACTION_EVENT, j as INTERACTION_RESOLVED_EVENT, k as InteractionAnswerValue, I as InteractionAnswers, c as InteractionCancelData, l as InteractionPersistedPart, N as NoticeKind, m as NoticePersistedPart, P as ParseInteractionAnswersResult, n as ParseInteractionResult, o as canTransitionInteractionStatus, p as cancelStatusFor, q as composerAnswerData, r as composerAnswerDeliveries, s as dedupeQuestionInteractionsByContent, t as fieldAcceptsFreeText, u as interactionFromWireRequest, v as interactionPartKey, w as interactionToPersistedPart, x as isRenderableInteractionKind, y as isSafeInteractionFieldKey, z as isTerminalInteractionStatus, A as noticePart, B as noticePartKey, D as parseInteractionAnswers, E as parseInteractionCancel, F as parseInteractionRequest, G as persistedPartToInteraction, H as questionInteractionContentSignature, J as stampInteractionAnswers } from '../contract-OxG_jVMx.js';
|
|
3
3
|
import { InteractionOutcome, InteractionData } from '@tangle-network/agent-interface';
|
|
4
4
|
export { InteractionData, InteractionOutcome, InteractionRequest } from '@tangle-network/agent-interface';
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
mapInteractionRespondFailure,
|
|
8
8
|
respondToSessionInteraction,
|
|
9
9
|
validateInteractionAnswerBody
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-ZSSCVT6H.js";
|
|
11
11
|
import {
|
|
12
12
|
INTERACTION_CANCEL_EVENT,
|
|
13
13
|
INTERACTION_EVENT,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
persistedPartToInteraction,
|
|
33
33
|
questionInteractionContentSignature,
|
|
34
34
|
stampInteractionAnswers
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-M3K2HVQD.js";
|
|
36
36
|
export {
|
|
37
37
|
INTERACTION_CANCEL_EVENT,
|
|
38
38
|
INTERACTION_EVENT,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Part } from '@tangle-network/agent-interface';
|
|
2
|
-
import { C as ChatInteractionField, a as ChatInteractionStatus, I as InteractionAnswers, N as NoticeKind } from './contract-
|
|
2
|
+
import { C as ChatInteractionField, a as ChatInteractionStatus, I as InteractionAnswers, N as NoticeKind } from './contract-OxG_jVMx.js';
|
|
3
3
|
import { W as WorkProductPersistedPart } from './types-CCeYywdS.js';
|
|
4
4
|
import { ChatPlanPersistedPart } from './plans/index.js';
|
|
5
5
|
import { C as ChatMentionKind, a as ChatAttachmentKind, b as ChatAttachmentInput, F as FileMention } from './wire-DOZ-O6hD.js';
|
package/dist/run/index.js
CHANGED
package/dist/sandbox/index.js
CHANGED
|
@@ -86,8 +86,8 @@ import {
|
|
|
86
86
|
workspaceSandboxRecoveryMessage,
|
|
87
87
|
workspaceSandboxRecoveryRecommendedActions,
|
|
88
88
|
writeProfileFilesToBox
|
|
89
|
-
} from "../chunk-
|
|
90
|
-
import "../chunk-
|
|
89
|
+
} from "../chunk-6JPFYXEU.js";
|
|
90
|
+
import "../chunk-TH7L265V.js";
|
|
91
91
|
import "../chunk-LWSJK546.js";
|
|
92
92
|
import "../chunk-C5OIABSB.js";
|
|
93
93
|
import "../chunk-YOFQO4R6.js";
|
package/dist/stream/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { J as JsonRecord } from '../stream-normalizer-
|
|
2
|
-
export { M as MISSING_TOOL_TERMINAL_ERROR, b as MISSING_TOOL_TERMINAL_REASON, S as StreamEvent, c as asRecord, d as asString, a as attachmentPartKey, e as collapseRedundantTextParts, f as draftAssistantParts, g as encodeEvent, h as finalizeAssistantParts, i as finalizePendingInteractionParts, j as getPartKey, m as mergePersistedPart, n as normalizePersistedPart, k as normalizeTime, l as normalizeToolEvent, r as resolveToolId, o as resolveToolName, t as terminalizeDanglingAssistantToolUpdates, p as terminalizeDanglingToolPart, q as terminalizeDanglingToolParts } from '../stream-normalizer-
|
|
1
|
+
import { J as JsonRecord } from '../stream-normalizer-DKRxyVlZ.js';
|
|
2
|
+
export { M as MISSING_TOOL_TERMINAL_ERROR, b as MISSING_TOOL_TERMINAL_REASON, S as StreamEvent, c as asRecord, d as asString, a as attachmentPartKey, e as collapseRedundantTextParts, f as draftAssistantParts, g as encodeEvent, h as finalizeAssistantParts, i as finalizePendingInteractionParts, j as getPartKey, m as mergePersistedPart, n as normalizePersistedPart, k as normalizeTime, l as normalizeToolEvent, r as resolveToolId, o as resolveToolName, t as terminalizeDanglingAssistantToolUpdates, p as terminalizeDanglingToolPart, q as terminalizeDanglingToolParts } from '../stream-normalizer-DKRxyVlZ.js';
|
|
3
3
|
export { B as BufferedTurnEvent, a as BufferedTurnOptions, b as BufferedTurnTap, D as D1LikeForTurns, c as DEFAULT_RUNNING_TURN_LEASE_MS, d as DEFAULT_RUNNING_TURN_RENEW_INTERVAL_MS, P as PumpBufferedTurnOptions, R as ReplayTurnEventsOptions, e as TURN_EVENTS_MIGRATION_SQL, f as TURN_STATUS_SCOPE_MIGRATION_SQL, T as TurnEventStore, g as TurnEventStoreOptions, h as TurnStatus, i as coalesceChatStreamEvents, j as coalesceDeltas, k as createBufferedTurnTap, l as createD1TurnEventStore, m as createMemoryTurnEventStore, p as pumpBufferedTurn, r as replayTurnEvents, s as stampReplaySeq } from '../turn-buffer-COMQUwO2.js';
|
|
4
|
-
import '../contract-
|
|
4
|
+
import '../contract-OxG_jVMx.js';
|
|
5
5
|
import '@tangle-network/agent-interface';
|
|
6
6
|
|
|
7
7
|
/** Define the structure of a chat message stored for a specific conversation turn */
|
package/dist/stream/index.js
CHANGED
|
@@ -39,8 +39,8 @@ import {
|
|
|
39
39
|
terminalizeDanglingAssistantToolUpdates,
|
|
40
40
|
terminalizeDanglingToolPart,
|
|
41
41
|
terminalizeDanglingToolParts
|
|
42
|
-
} from "../chunk-
|
|
43
|
-
import "../chunk-
|
|
42
|
+
} from "../chunk-XZ27ENOZ.js";
|
|
43
|
+
import "../chunk-M3K2HVQD.js";
|
|
44
44
|
import "../chunk-YJMCRXQQ.js";
|
|
45
45
|
export {
|
|
46
46
|
DEFAULT_RUNNING_TURN_LEASE_MS,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, RefObject } from 'react';
|
|
3
|
-
import { C as ChatInteractionField, I as InteractionAnswers, a as ChatInteractionStatus, b as ChatInteraction, c as InteractionCancelData, d as ChatSelectField, e as InteractionRequestWire } from '../contract-
|
|
4
|
-
export { f as ChatFreeTextField, g as ComposerAnswerDelivery, h as INTERACTION_CANCEL_EVENT, i as INTERACTION_EVENT, j as INTERACTION_RESOLVED_EVENT, k as InteractionAnswerValue, l as InteractionPersistedPart, N as NoticeKind, m as NoticePersistedPart, P as ParseInteractionAnswersResult, n as ParseInteractionResult, o as canTransitionInteractionStatus, p as cancelStatusFor, q as composerAnswerData, r as composerAnswerDeliveries, s as dedupeQuestionInteractionsByContent, t as fieldAcceptsFreeText, u as interactionFromWireRequest, v as interactionPartKey, w as interactionToPersistedPart, x as isRenderableInteractionKind, y as isSafeInteractionFieldKey, z as isTerminalInteractionStatus, A as noticePart, B as noticePartKey, D as parseInteractionAnswers, E as parseInteractionCancel, F as parseInteractionRequest, G as persistedPartToInteraction, H as questionInteractionContentSignature, J as stampInteractionAnswers } from '../contract-
|
|
3
|
+
import { C as ChatInteractionField, I as InteractionAnswers, a as ChatInteractionStatus, b as ChatInteraction, c as InteractionCancelData, d as ChatSelectField, e as InteractionRequestWire } from '../contract-OxG_jVMx.js';
|
|
4
|
+
export { f as ChatFreeTextField, g as ComposerAnswerDelivery, h as INTERACTION_CANCEL_EVENT, i as INTERACTION_EVENT, j as INTERACTION_RESOLVED_EVENT, k as InteractionAnswerValue, l as InteractionPersistedPart, N as NoticeKind, m as NoticePersistedPart, P as ParseInteractionAnswersResult, n as ParseInteractionResult, o as canTransitionInteractionStatus, p as cancelStatusFor, q as composerAnswerData, r as composerAnswerDeliveries, s as dedupeQuestionInteractionsByContent, t as fieldAcceptsFreeText, u as interactionFromWireRequest, v as interactionPartKey, w as interactionToPersistedPart, x as isRenderableInteractionKind, y as isSafeInteractionFieldKey, z as isTerminalInteractionStatus, A as noticePart, B as noticePartKey, D as parseInteractionAnswers, E as parseInteractionCancel, F as parseInteractionRequest, G as persistedPartToInteraction, H as questionInteractionContentSignature, J as stampInteractionAnswers } from '../contract-OxG_jVMx.js';
|
|
5
5
|
import { ChatPlan } from '../plans/index.js';
|
|
6
6
|
import { InteractionData } from '@tangle-network/agent-interface';
|
|
7
7
|
export { InteractionData, InteractionOutcome, InteractionRequest } from '@tangle-network/agent-interface';
|
|
8
|
-
import { e as ChatMentionPart, a as ChatAttachmentPart } from '../parts-
|
|
9
|
-
export { s as attachmentInputToPart, t as attachmentKindForMime, u as attachmentPartsFromMessageParts, x as isChatAttachmentPart, H as mentionInputToPart, I as mentionPartsFromMessageParts } from '../parts-
|
|
8
|
+
import { e as ChatMentionPart, a as ChatAttachmentPart } from '../parts-BqIHMdyu.js';
|
|
9
|
+
export { s as attachmentInputToPart, t as attachmentKindForMime, u as attachmentPartsFromMessageParts, x as isChatAttachmentPart, H as mentionInputToPart, I as mentionPartsFromMessageParts } from '../parts-BqIHMdyu.js';
|
|
10
10
|
import { E as EvidenceEntry, g as ExceptionEntry, b as WorkProductProvenance, P as ProfileBacktestSummary, Q as QualityCheck, W as WorkProductPersistedPart, h as WorkProductStatus } from '../types-CCeYywdS.js';
|
|
11
11
|
export { C as ComposerMentionProp, D as DEFAULT_MENTION_EMPTY_TEXT, a as DEFAULT_MENTION_LIMIT, I as INDEX_REFRESH_AFTER_MS, M as MentionItem, b as UseFileMentionsOptions, U as UseFileMentionsResult, r as rankFileMentions, u as useFileMentions } from '../use-file-mentions-CZ-Ua_sb.js';
|
|
12
12
|
import { a as ChatAttachmentKind, b as ChatAttachmentInput } from '../wire-DOZ-O6hD.js';
|
|
@@ -21,7 +21,7 @@ import { SessionSort, SessionPage, SessionSummary, SessionRailAction } from '../
|
|
|
21
21
|
import { CatalogModel } from '../catalog/index.js';
|
|
22
22
|
import { Harness } from '../harness/index.js';
|
|
23
23
|
export { a as ATTACHMENT_ACCEPT, e as FileIndexReadyResponse, f as FileIndexResponse, g as FileIndexWarmingResponse } from '../attachment-validation-CsmUzuI3.js';
|
|
24
|
-
export { a as attachmentPartKey } from '../stream-normalizer-
|
|
24
|
+
export { a as attachmentPartKey } from '../stream-normalizer-DKRxyVlZ.js';
|
|
25
25
|
import '../billing/index.js';
|
|
26
26
|
|
|
27
27
|
/** Represent durable plan decisions as either approved or rejected */
|
package/dist/web-react/index.js
CHANGED
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
useSmoothText,
|
|
79
79
|
useThinkingSeconds,
|
|
80
80
|
waterfallLayout
|
|
81
|
-
} from "../chunk-
|
|
81
|
+
} from "../chunk-2Z56V2ZW.js";
|
|
82
82
|
import {
|
|
83
83
|
useComposerAttachments
|
|
84
84
|
} from "../chunk-6MUJROBT.js";
|
|
@@ -114,7 +114,7 @@ import {
|
|
|
114
114
|
isChatAttachmentPart,
|
|
115
115
|
mentionInputToPart,
|
|
116
116
|
mentionPartsFromMessageParts
|
|
117
|
-
} from "../chunk-
|
|
117
|
+
} from "../chunk-B2UEW62O.js";
|
|
118
118
|
import {
|
|
119
119
|
DISPATCH_MAX_MEDIA_PARTS,
|
|
120
120
|
DISPATCH_MAX_PARTS,
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
import "../chunk-ZVEEWGDK.js";
|
|
131
131
|
import {
|
|
132
132
|
attachmentPartKey
|
|
133
|
-
} from "../chunk-
|
|
133
|
+
} from "../chunk-XZ27ENOZ.js";
|
|
134
134
|
import {
|
|
135
135
|
INTERACTION_CANCEL_EVENT,
|
|
136
136
|
INTERACTION_EVENT,
|
|
@@ -155,9 +155,9 @@ import {
|
|
|
155
155
|
persistedPartToInteraction,
|
|
156
156
|
questionInteractionContentSignature,
|
|
157
157
|
stampInteractionAnswers
|
|
158
|
-
} from "../chunk-
|
|
158
|
+
} from "../chunk-M3K2HVQD.js";
|
|
159
159
|
import "../chunk-YJMCRXQQ.js";
|
|
160
|
-
import "../chunk-
|
|
160
|
+
import "../chunk-TH7L265V.js";
|
|
161
161
|
export {
|
|
162
162
|
ATTACHMENT_ACCEPT,
|
|
163
163
|
AgentActivityPanel,
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { SidebarLayoutProps, SidebarLayoutNavItem } from '@tangle-network/sandbox-ui/dashboard';
|
|
4
|
+
import { NavRouteDef, SessionSummary, SessionRowActions, RailPrefetch } from '../session-shell/index.js';
|
|
5
|
+
|
|
6
|
+
type WorkspaceIcon = SidebarLayoutNavItem['icon'];
|
|
7
|
+
/** The session data and product-owned URLs needed by the default workspace. */
|
|
8
|
+
interface AgentWorkspaceSessionConfig {
|
|
9
|
+
/** Icon shown beside the expandable History row. */
|
|
10
|
+
icon: WorkspaceIcon;
|
|
11
|
+
/** Id for the session row; defaults to `history`. */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** Product copy for the session row; defaults to `History`. */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** Full-history route used by the row and overflow item. */
|
|
16
|
+
href: string;
|
|
17
|
+
/** Product-owned URL for an individual session. */
|
|
18
|
+
hrefForSession: (sessionId: string) => string;
|
|
19
|
+
/** Server-loaded rows, ordered by the product's query. */
|
|
20
|
+
sessions: SessionSummary[];
|
|
21
|
+
/** Sessions created by another tab before the loader revalidates. */
|
|
22
|
+
optimisticSessions?: SessionSummary[];
|
|
23
|
+
/** Number of rows shown in the rail before the full-history link. */
|
|
24
|
+
limit?: number;
|
|
25
|
+
/** Total persisted session count, used to decide whether overflow exists. */
|
|
26
|
+
totalCount?: number;
|
|
27
|
+
/** Session currently open in the route. */
|
|
28
|
+
activeSessionId?: string | null;
|
|
29
|
+
/** Sessions with a live turn. */
|
|
30
|
+
respondingSessionIds?: ReadonlySet<string>;
|
|
31
|
+
/** Live unread ids from the product's event channel. */
|
|
32
|
+
liveUnreadIds?: ReadonlySet<string>;
|
|
33
|
+
/** Ids this tab has opened since the loader ran. */
|
|
34
|
+
locallyReadIds?: ReadonlySet<string>;
|
|
35
|
+
/** Optional product-owned rename/delete/pin actions. */
|
|
36
|
+
actions?: SessionRowActions<WorkspaceIcon>;
|
|
37
|
+
/** Label for the overflow row. Defaults to `View all chats`. */
|
|
38
|
+
overflowLabel?: string;
|
|
39
|
+
/** Empty state for the expanded rail row. Defaults to `No chats yet`. */
|
|
40
|
+
emptyLabel?: string;
|
|
41
|
+
/** Fallback title for untitled sessions. */
|
|
42
|
+
untitledLabel?: string;
|
|
43
|
+
/** Router prefetch behavior for session links. */
|
|
44
|
+
prefetch?: RailPrefetch;
|
|
45
|
+
/** Whether History starts expanded. Defaults to `true`. */
|
|
46
|
+
defaultOpen?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** Route data for the shared active-nav resolver. */
|
|
49
|
+
interface AgentWorkspaceActiveRoute {
|
|
50
|
+
/** Current browser pathname, including the product's workspace base. */
|
|
51
|
+
pathname: string;
|
|
52
|
+
/** Product route root, for example `/app/ws_123`. */
|
|
53
|
+
base: string;
|
|
54
|
+
/** Product-owned rail routes, relative to `base`. */
|
|
55
|
+
routes: NavRouteDef[];
|
|
56
|
+
/** Extra route prefixes that should highlight an existing row. */
|
|
57
|
+
aliases?: Record<string, string>;
|
|
58
|
+
/** Route prefixes that intentionally highlight no row. */
|
|
59
|
+
claimsNothing?: string[];
|
|
60
|
+
}
|
|
61
|
+
interface AgentWorkspaceLayoutProps extends Omit<SidebarLayoutProps, 'activeId' | 'children' | 'navItems' | 'hideBelow' | 'railLabels'> {
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
/** Product-owned destinations. The shared History row is appended after them. */
|
|
64
|
+
navItems: SidebarLayoutNavItem[];
|
|
65
|
+
/** Omit for a workflow-only shell with no conversational session rail. */
|
|
66
|
+
sessions?: AgentWorkspaceSessionConfig;
|
|
67
|
+
/** When supplied, active navigation is resolved by the shared route rules. */
|
|
68
|
+
activeRoute?: AgentWorkspaceActiveRoute;
|
|
69
|
+
/** Escape hatch for routers that already resolved the active item. */
|
|
70
|
+
activeId?: string;
|
|
71
|
+
/** Hide the fixed desktop rail below this breakpoint. Defaults to `lg`. */
|
|
72
|
+
hideBelow?: SidebarLayoutProps['hideBelow'];
|
|
73
|
+
/** Show labels beside rail icons. Defaults to `true`. */
|
|
74
|
+
railLabels?: SidebarLayoutProps['railLabels'];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The default agent workspace composition.
|
|
78
|
+
*
|
|
79
|
+
* Products own their navigation taxonomy, routes, and session storage. This
|
|
80
|
+
* component owns the repeated assembly: the standard visual layout, the
|
|
81
|
+
* expandable History row, capped session composition, unread state, and active
|
|
82
|
+
* route resolution. The full History route and the empty-state composer stay
|
|
83
|
+
* separate because their data and domain copy belong to the product; pair this
|
|
84
|
+
* with `SessionHistoryPanel` and `EntryComposer` for the complete chat-first
|
|
85
|
+
* structure.
|
|
86
|
+
*/
|
|
87
|
+
declare function AgentWorkspaceLayout({ children, navItems, sessions, activeRoute, activeId, ...sidebarProps }: AgentWorkspaceLayoutProps): react.JSX.Element;
|
|
88
|
+
|
|
89
|
+
export { type AgentWorkspaceActiveRoute, AgentWorkspaceLayout, type AgentWorkspaceLayoutProps, type AgentWorkspaceSessionConfig };
|