@tangle-network/agent-app 0.60.228 → 0.60.230
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 +8 -0
- package/dist/chat-routes/index.js +1 -1
- package/dist/chat-routes/turn-admission.d.ts +43 -0
- package/dist/chat-routes/turn-event-stream.d.ts +31 -0
- package/dist/chat-routes/turn-execution.d.ts +23 -0
- package/dist/chat-routes/turn-route-contracts.d.ts +724 -0
- package/dist/chat-routes/turn-routes.d.ts +2 -723
- package/dist/chunk-NMZUW6VJ.js +29 -0
- package/dist/chunk-NMZUW6VJ.js.map +1 -0
- package/dist/{chunk-PTB2B2OO.js → chunk-RMPPWNW7.js} +363 -336
- package/dist/chunk-RMPPWNW7.js.map +1 -0
- package/dist/design-canvas/index.js +42 -32
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas/mcp-context.d.ts +51 -0
- package/dist/design-canvas/mcp-elements-tools.d.ts +3 -0
- package/dist/design-canvas/mcp-input.d.ts +35 -0
- package/dist/design-canvas/mcp-pages-tools.d.ts +3 -0
- package/dist/design-canvas/mcp-read-tools.d.ts +3 -0
- package/dist/design-canvas/mcp-templates-tools.d.ts +3 -0
- package/dist/design-canvas/mcp-tools.d.ts +3 -9
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +1 -1
- package/dist/sequences/index.js +6 -20
- package/dist/sequences/index.js.map +1 -1
- package/dist/sequences/mcp-tools.d.ts +0 -18
- package/dist/skills-placement/index.d.ts +16 -3
- package/dist/skills-placement/index.js +11 -7
- package/dist/skills-placement/index.js.map +1 -1
- package/dist/tools/mcp-arguments.d.ts +4 -0
- package/package.json +1 -1
- package/dist/chunk-PTB2B2OO.js.map +0 -1
package/README.md
CHANGED
|
@@ -255,3 +255,11 @@ Products can read `currentD1QueryCounter()` from `/launch-invariants` for phase
|
|
|
255
255
|
counts. A custom turn owner uses `withD1QueryCount(() => { ... })` around its
|
|
256
256
|
entire turn and passes `d1QueryCounter: currentD1QueryCounter()` to
|
|
257
257
|
`createTurnTrace`; the recorder captures the total at finish.
|
|
258
|
+
|
|
259
|
+
## Skill support-file policies
|
|
260
|
+
|
|
261
|
+
`withSkillSupportFiles` from `/skills-placement` keeps identical mounts by
|
|
262
|
+
default. Its optional fifth argument can name new resources with `resourceName`
|
|
263
|
+
and use `reconcileExisting: 'replace'` to append owned support files in canonical
|
|
264
|
+
order while preserving foreign mounts. The exact-content ownership and
|
|
265
|
+
all-destinations-occupied behavior are documented in the [helper source](src/skills-placement/index.ts).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Validated request and transcript projections at the chat-route boundary. */
|
|
2
|
+
import { type ChatMessagePart } from '../chat-store/parts';
|
|
3
|
+
import type { TurnTrace } from '../turn-trace/recorder';
|
|
4
|
+
import type { ChatTurnAuthorization } from './turn-route-contracts';
|
|
5
|
+
import { ChatTurnInputError, type ChatTurnFilePartInput, type ChatTurnRequestPayload, type FileMention } from './wire';
|
|
6
|
+
/** A turn whose body parsed and whose caller `authorize` admitted. */
|
|
7
|
+
export type AdmittedTurn<TContext> = {
|
|
8
|
+
parsed: ParsedTurnBody;
|
|
9
|
+
auth: Extract<ChatTurnAuthorization<TContext>, {
|
|
10
|
+
ok: true;
|
|
11
|
+
}>;
|
|
12
|
+
trace: TurnTrace;
|
|
13
|
+
};
|
|
14
|
+
/** Emits one stage on a progress-first stream. */
|
|
15
|
+
export type TurnProgress = (phase: string, message: string) => void;
|
|
16
|
+
export declare function errorResponse(err: ChatTurnInputError): Response;
|
|
17
|
+
export interface ParsedTurnBody {
|
|
18
|
+
payload: ChatTurnRequestPayload;
|
|
19
|
+
content: string;
|
|
20
|
+
fileParts: ChatTurnFilePartInput[];
|
|
21
|
+
mentions: FileMention[];
|
|
22
|
+
turnId: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The turn's admission as a `Server-Timing` value: `admission` for the
|
|
26
|
+
* request-to-stream wall time, then each `admission.*` span the trace holds in
|
|
27
|
+
* start order. A timed request reads where admission went from the response
|
|
28
|
+
* headers alone; the same spans reach the trace sink.
|
|
29
|
+
*/
|
|
30
|
+
export declare function admissionServerTiming(trace: TurnTrace): string;
|
|
31
|
+
export declare function validateTurnBody(body: Record<string, unknown>, maxInlinePartBytes: number | undefined): ParsedTurnBody;
|
|
32
|
+
/** File parts persist onto the user message verbatim — the wire shape is the
|
|
33
|
+
* persisted `ChatFilePart`/`ChatImagePart` vocabulary already. Mentions get
|
|
34
|
+
* the one mapping step their own vocabulary needs. The typed projection is
|
|
35
|
+
* `/chat-store`'s (same boundary as the assistant hop).
|
|
36
|
+
*
|
|
37
|
+
* Mentions persist as parts rather than being folded into the prompt because
|
|
38
|
+
* the prompt is not readable back: a retry rebuilds the turn from the stored
|
|
39
|
+
* row, and a transcript draws its pills from it. Turning them INTO prompt
|
|
40
|
+
* text stays the product's job — only the product knows how to resolve a
|
|
41
|
+
* workspace-relative path to an in-box one (`fileMentionsToParts`'
|
|
42
|
+
* `resolvePath` seam), so the route never dispatches them itself. */
|
|
43
|
+
export declare function userPartsWithFiles(userParts: Array<Record<string, unknown>>, fileParts: ChatTurnFilePartInput[], mentions: FileMention[]): ChatMessagePart[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Stream framing, event inspection and cancellation around a chat producer. */
|
|
2
|
+
import type { ChatRouteEvent } from './turn-route-contracts';
|
|
3
|
+
/** Best-effort human-readable cause from a terminal `error` /
|
|
4
|
+
* `session.run.failed` event's `data`. */
|
|
5
|
+
export declare function failureReasonOf(data: Record<string, unknown> | undefined): string | undefined;
|
|
6
|
+
/** The typed reason a terminal `error` / `session.run.failed` event's `data`
|
|
7
|
+
* names, e.g. `sandbox.stream_failed` or an upstream code. */
|
|
8
|
+
export declare function failureCodeOf(data: Record<string, unknown> | undefined): string | undefined;
|
|
9
|
+
/** A word the user sees: a producer `text` event, or a sandbox text part delta. */
|
|
10
|
+
export declare function isVisibleText(event: ChatRouteEvent): boolean;
|
|
11
|
+
/** Output rendered by either lane; admission/status/usage events are not model output. */
|
|
12
|
+
export declare function isVisibleOutput(event: ChatRouteEvent): boolean;
|
|
13
|
+
/** Fire `onRawEvent` for each producer event, before the engine frames it.
|
|
14
|
+
* Best-effort — a telemetry throw is logged, never propagated. */
|
|
15
|
+
export declare function tapRawEvents(source: AsyncIterable<ChatRouteEvent>, onRawEvent: (event: ChatRouteEvent) => void | Promise<void>, log: (message: string, meta?: Record<string, unknown>) => void): AsyncGenerator<ChatRouteEvent, void, unknown>;
|
|
16
|
+
/** Inject a keepalive whenever `intervalMs` elapses with no source event. The
|
|
17
|
+
* silent window (elapsed + tick) resets on every real event, so a producer
|
|
18
|
+
* that keeps emitting never triggers a heartbeat. Closes the source on early
|
|
19
|
+
* return, matching a `for await` over it. */
|
|
20
|
+
export declare function withStreamHeartbeat(source: AsyncIterable<ChatRouteEvent>, intervalMs: number, makeEvent: (info: {
|
|
21
|
+
elapsedMs: number;
|
|
22
|
+
tick: number;
|
|
23
|
+
}) => ChatRouteEvent): AsyncGenerator<ChatRouteEvent, void, unknown>;
|
|
24
|
+
/** Sequential concat of byte streams (marker line, then the engine body). */
|
|
25
|
+
export declare function concatStreams(streams: ReadableStream<Uint8Array>[]): ReadableStream<Uint8Array>;
|
|
26
|
+
/**
|
|
27
|
+
* Stop a producer pull as soon as an opted-in caller disconnects.
|
|
28
|
+
* `AsyncIterator.return()` alone cannot interrupt a pending `next()` call, so
|
|
29
|
+
* race each pull with the request signal and close the source in `finally`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function abortOnSignal<T>(source: AsyncIterable<T>, signal: AbortSignal): AsyncGenerator<T, void, unknown>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TurnTraceSink } from '../turn-trace/recorder';
|
|
2
|
+
import { type AssistantDraftStore, type DraftPersistenceTuning } from './draft-persistence';
|
|
3
|
+
import { type AdmittedTurn, type TurnProgress } from './turn-admission';
|
|
4
|
+
import type { ChatTurnRequestContext, ChatTurnTraceOptions, CreateChatTurnRoutesOptions } from './turn-route-contracts';
|
|
5
|
+
import type { TurnRoutePhase } from './turn-progress';
|
|
6
|
+
/** Work `afterAuthorize` started: `handOff` gives it to `produce`; `release` frees it if nothing took it. */
|
|
7
|
+
export interface AfterAuthorizeWork {
|
|
8
|
+
handOff(): void;
|
|
9
|
+
release(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
interface TurnExecutionOptions<TContext> {
|
|
12
|
+
options: CreateChatTurnRoutesOptions<TContext>;
|
|
13
|
+
draftStore: AssistantDraftStore;
|
|
14
|
+
draftTuning: DraftPersistenceTuning | null;
|
|
15
|
+
progressMessages: Record<TurnRoutePhase, string>;
|
|
16
|
+
traceOptions: ChatTurnTraceOptions<TContext> | undefined;
|
|
17
|
+
traceSink: TurnTraceSink | undefined;
|
|
18
|
+
startIntentLine(admitted: AdmittedTurn<TContext>): Promise<string | null> | undefined;
|
|
19
|
+
log(message: string, meta?: Record<string, unknown>): void;
|
|
20
|
+
}
|
|
21
|
+
/** Bind the route's construction-time dependencies; each invocation retains its own turn state. */
|
|
22
|
+
export declare function createAdmittedTurnRunner<TContext>({ options, draftStore, draftTuning, progressMessages, traceOptions, traceSink, startIntentLine, log, }: TurnExecutionOptions<TContext>): (request: Request, ctx: ChatTurnRequestContext | undefined, admitted: AdmittedTurn<TContext>, early: AfterAuthorizeWork, progress?: TurnProgress, startedIntent?: Promise<string | null>) => Promise<Response>;
|
|
23
|
+
export {};
|