@weiliang0121/capix-protocol 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -12
- package/dist/acceptance.d.ts +3 -0
- package/dist/acceptance.js +2 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.js +1 -1
- package/dist/transcript.d.ts +43 -0
- package/package.json +9 -25
- package/dist/content/changes.d.ts +0 -35
- package/dist/content/changes.js +0 -1
- package/dist/content/index.d.ts +0 -4
- package/dist/content/index.js +0 -2
- package/dist/content/memory.d.ts +0 -13
- package/dist/content/memory.js +0 -1
- package/dist/content/message.d.ts +0 -4
- package/dist/content/message.js +0 -1
- package/dist/content/transcript.d.ts +0 -32
- package/dist/conversation/activity.d.ts +0 -36
- package/dist/conversation/activity.js +0 -1
- package/dist/conversation/conversation.d.ts +0 -11
- package/dist/conversation/conversation.js +0 -1
- package/dist/conversation/delivery.d.ts +0 -99
- package/dist/conversation/delivery.js +0 -1
- package/dist/conversation/files.d.ts +0 -30
- package/dist/conversation/files.js +0 -1
- package/dist/conversation/generation.d.ts +0 -4
- package/dist/conversation/generation.js +0 -1
- package/dist/conversation/index.d.ts +0 -10
- package/dist/conversation/index.js +0 -2
- package/dist/conversation/preview.d.ts +0 -46
- package/dist/conversation/preview.js +0 -1
- package/dist/conversation/recovery.d.ts +0 -29
- package/dist/conversation/recovery.js +0 -1
- package/dist/conversation/service.d.ts +0 -75
- package/dist/conversation/service.js +0 -1
- package/dist/conversation/settings.d.ts +0 -6
- package/dist/conversation/settings.js +0 -1
- package/dist/conversation/task.d.ts +0 -11
- package/dist/conversation/task.js +0 -1
- package/dist/invocation/changes.d.ts +0 -28
- package/dist/invocation/changes.js +0 -1
- package/dist/invocation/errors.d.ts +0 -1
- package/dist/invocation/errors.js +0 -1
- package/dist/invocation/index.d.ts +0 -3
- package/dist/invocation/index.js +0 -2
- package/dist/invocation/types.d.ts +0 -16
- package/dist/invocation/types.js +0 -2
- package/dist/observer/archive.d.ts +0 -9
- package/dist/observer/archive.js +0 -2
- package/dist/observer/changes.d.ts +0 -4
- package/dist/observer/changes.js +0 -1
- package/dist/observer/execution.d.ts +0 -10
- package/dist/observer/execution.js +0 -1
- package/dist/observer/index.d.ts +0 -8
- package/dist/observer/index.js +0 -2
- package/dist/observer/interaction.d.ts +0 -31
- package/dist/observer/interaction.js +0 -1
- package/dist/observer/memory.d.ts +0 -13
- package/dist/observer/memory.js +0 -1
- package/dist/observer/overview.d.ts +0 -45
- package/dist/observer/overview.js +0 -1
- package/dist/observer/selection.d.ts +0 -19
- package/dist/observer/selection.js +0 -1
- package/dist/observer/stream.d.ts +0 -56
- package/dist/observer/stream.js +0 -1
- package/dist/recording/changes.d.ts +0 -43
- package/dist/recording/changes.js +0 -1
- package/dist/recording/index.d.ts +0 -7
- package/dist/recording/index.js +0 -2
- package/dist/recording/invocation.d.ts +0 -10
- package/dist/recording/invocation.js +0 -2
- package/dist/recording/memory.d.ts +0 -18
- package/dist/recording/memory.js +0 -1
- package/dist/recording/resource.d.ts +0 -10
- package/dist/recording/resource.js +0 -1
- package/dist/recording/transcript.d.ts +0 -19
- package/dist/recording/transcript.js +0 -1
- package/dist/recording/types.d.ts +0 -190
- package/dist/recording/types.js +0 -2
- package/dist/recording/validate.d.ts +0 -4
- package/dist/recording/validate.js +0 -2
- /package/dist/{content/transcript.js → transcript.js} +0 -0
package/README.md
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
# @weiliang0121/capix-protocol
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ES modules and TypeScript declarations. Requires Node.js 22.23.2 or newer.
|
|
3
|
+
Explicit Transcript baseline, delta and error wire values, with single-frame admission. The only public entry point is the package root.
|
|
6
4
|
|
|
7
5
|
```sh
|
|
8
6
|
npm install @weiliang0121/capix-protocol
|
|
9
7
|
```
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
```ts
|
|
10
|
+
import { acceptTranscriptUpdate, type TranscriptUpdate } from '@weiliang0121/capix-protocol';
|
|
11
|
+
|
|
12
|
+
const update: TranscriptUpdate = acceptTranscriptUpdate(JSON.parse(payload));
|
|
13
|
+
if (update.type === 'baseline') console.log(update.snapshot.messages);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`acceptTranscriptUpdate` validates one complete value, rejects unknown fields and invalid message/range/segment/revision shapes, and returns fixed data. This does not establish delivery continuity, replace a consumer's source, authorize recovery or implement HTTP. Those responsibilities belong to the consuming application.
|
|
17
|
+
|
|
18
|
+
Public types: `TranscriptWireMessage`, `TranscriptWireSnapshot`, `TranscriptWireEvent`, `TranscriptFrame`, `TranscriptUpdate`. These are explicit transport representations; entity APIs belong to `capix-transcript`. Invocation events belong to `capix-invocation/events`, record data and validation to `capix-records/data`, and shared relation identity to `capix-contracts`.
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
- `@weiliang0121/capix-protocol/content`
|
|
15
|
-
- `@weiliang0121/capix-protocol/invocation`
|
|
16
|
-
- `@weiliang0121/capix-protocol/conversation`
|
|
17
|
-
- `@weiliang0121/capix-protocol/recording`
|
|
18
|
-
- `@weiliang0121/capix-protocol/observer`
|
|
20
|
+
Application DTOs and endpoint admission belong to each host application. This package does not reexport entity implementations or business protocols.
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
ES modules and TypeScript declarations. The npm distribution contains compiled JavaScript, declarations, this README and the MIT license; no HTTP, Node-specific implementation or UI dependency is introduced by this entry point.
|
|
21
23
|
|
|
22
24
|
## License
|
|
23
25
|
|
|
24
|
-
MIT. Copyright (c) 2026 wei.liang. See [LICENSE](
|
|
26
|
+
MIT. Copyright (c) 2026 wei.liang. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
2
|
+
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{stableValue}from"@weiliang0121/capix-contracts";function acceptTranscriptUpdate(value){const fixed=stableValue(value),update=record(fixed);if(update.type==="baseline"){keys(update,["type","snapshot"]);const snapshot=record(update.snapshot);keys(snapshot,["id","revision","start","end","starts","messages"]),text(snapshot.id),integer(snapshot.revision),integer(snapshot.end),snapshot.start!==0&&fail(),messages(snapshot.messages),(snapshot.messages.length!==snapshot.end||!Array.isArray(snapshot.starts)||snapshot.starts.length===0||snapshot.starts[0]!==0)&&fail();let previous=-1;for(const start of snapshot.starts)integer(start),(start<=previous||previous>=0&&start>=snapshot.end)&&fail(),previous=start;const minimumRevision=snapshot.messages.length?snapshot.starts.length:0,maximumRevision=snapshot.messages.length+snapshot.starts.length-1;(snapshot.revision<minimumRevision||snapshot.revision>maximumRevision)&&fail()}else if(update.type==="delta"){keys(update,["type","event"]);const event=record(update.event);if(keys(event,["type","transcriptId","revision","occurredAt","change"],["origin"]),event.type!=="transcript"&&fail(),text(event.transcriptId),integer(event.revision,1),text(event.occurredAt),Number.isFinite(Date.parse(event.occurredAt))||fail(),Object.hasOwn(event,"origin")){const origin=record(event.origin);keys(origin,["contextId"]),text(origin.contextId)}const change=record(event.change);change.kind==="messages-appended"?(keys(change,["kind","start","messages"]),integer(change.start),messages(change.messages),(change.messages.length===0||!Number.isSafeInteger(change.start+change.messages.length))&&fail()):change.kind==="segment-started"?(keys(change,["kind","previousStart","start","end"]),integer(change.previousStart),integer(change.start),integer(change.end),(change.previousStart>=change.start||change.start>=change.end)&&fail()):fail()}else update.type==="error"?(keys(update,["type","code","error"]),text(update.code),text(update.error)):fail();return fixed}__name(acceptTranscriptUpdate,"acceptTranscriptUpdate");function fail(){throw new TypeError("Invalid transcript update")}__name(fail,"fail");function record(value){return(value===null||typeof value!="object"||Array.isArray(value))&&fail(),value}__name(record,"record");function keys(value,required,optional=[]){(!required.every(key=>Object.hasOwn(value,key))||Object.keys(value).some(key=>!required.includes(key)&&!optional.includes(key)))&&fail()}__name(keys,"keys");function text(value){(typeof value!="string"||!/\S/u.test(value))&&fail()}__name(text,"text");function integer(value,minimum=0){(!Number.isSafeInteger(value)||value<minimum||Object.is(value,-0))&&fail()}__name(integer,"integer");function messages(value){Array.isArray(value)||fail();for(const raw of value){const message=record(raw);keys(message,["role","content"]),message.role!=="user"&&message.role!=="assistant"&&fail(),text(message.content)}}__name(messages,"messages");export{acceptTranscriptUpdate};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export * from './conversation/index.js';
|
|
4
|
-
export * from './recording/index.js';
|
|
5
|
-
export * from './observer/index.js';
|
|
1
|
+
export type { TranscriptWireMessage, TranscriptWireSnapshot, TranscriptWireEvent, TranscriptFrame, TranscriptUpdate } from './transcript.js';
|
|
2
|
+
export { acceptTranscriptUpdate } from './acceptance.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
2
|
-
|
|
2
|
+
import{acceptTranscriptUpdate}from"./acceptance.js";export{acceptTranscriptUpdate};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface TranscriptWireMessage {
|
|
2
|
+
readonly role: 'user' | 'assistant';
|
|
3
|
+
readonly content: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TranscriptWireSnapshot {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly revision: number;
|
|
8
|
+
readonly start: 0;
|
|
9
|
+
readonly end: number;
|
|
10
|
+
readonly starts: readonly number[];
|
|
11
|
+
readonly messages: readonly TranscriptWireMessage[];
|
|
12
|
+
}
|
|
13
|
+
export type TranscriptWireEvent = Readonly<{
|
|
14
|
+
type: 'transcript';
|
|
15
|
+
transcriptId: string;
|
|
16
|
+
revision: number;
|
|
17
|
+
occurredAt: string;
|
|
18
|
+
origin?: Readonly<{
|
|
19
|
+
contextId: string;
|
|
20
|
+
}>;
|
|
21
|
+
change: Readonly<{
|
|
22
|
+
kind: 'messages-appended';
|
|
23
|
+
start: number;
|
|
24
|
+
messages: readonly TranscriptWireMessage[];
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
kind: 'segment-started';
|
|
27
|
+
previousStart: number;
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
export type TranscriptFrame = {
|
|
33
|
+
readonly type: 'baseline';
|
|
34
|
+
readonly snapshot: TranscriptWireSnapshot;
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: 'delta';
|
|
37
|
+
readonly event: TranscriptWireEvent;
|
|
38
|
+
};
|
|
39
|
+
export type TranscriptUpdate = TranscriptFrame | {
|
|
40
|
+
readonly type: 'error';
|
|
41
|
+
readonly code: string;
|
|
42
|
+
readonly error: string;
|
|
43
|
+
};
|
package/package.json
CHANGED
|
@@ -1,44 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weiliang0121/capix-protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"import": "./dist/index.js"
|
|
10
|
-
},
|
|
11
|
-
"./content": {
|
|
12
|
-
"types": "./dist/content/index.d.ts",
|
|
13
|
-
"import": "./dist/content/index.js"
|
|
14
|
-
},
|
|
15
|
-
"./invocation": {
|
|
16
|
-
"types": "./dist/invocation/index.d.ts",
|
|
17
|
-
"import": "./dist/invocation/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./conversation": {
|
|
20
|
-
"types": "./dist/conversation/index.d.ts",
|
|
21
|
-
"import": "./dist/conversation/index.js"
|
|
22
|
-
},
|
|
23
|
-
"./recording": {
|
|
24
|
-
"types": "./dist/recording/index.d.ts",
|
|
25
|
-
"import": "./dist/recording/index.js"
|
|
26
|
-
},
|
|
27
|
-
"./observer": {
|
|
28
|
-
"types": "./dist/observer/index.d.ts",
|
|
29
|
-
"import": "./dist/observer/index.js"
|
|
30
10
|
}
|
|
31
11
|
},
|
|
32
12
|
"dependencies": {
|
|
33
|
-
"@weiliang0121/capix-contracts": "0.
|
|
13
|
+
"@weiliang0121/capix-contracts": "0.3.0"
|
|
34
14
|
},
|
|
35
|
-
"description": "
|
|
15
|
+
"description": "Explicit transcript baseline and delta wire contracts for CAPiX.",
|
|
36
16
|
"license": "MIT",
|
|
37
17
|
"author": "wei.liang (https://github.com/weiliang0121)",
|
|
38
18
|
"repository": {
|
|
39
19
|
"type": "git",
|
|
40
20
|
"url": "git+https://github.com/weiliang0121/capix.git",
|
|
41
|
-
"directory": "protocol"
|
|
21
|
+
"directory": "packages/protocol"
|
|
42
22
|
},
|
|
43
23
|
"engines": {
|
|
44
24
|
"node": ">=22.23.2"
|
|
@@ -55,8 +35,12 @@
|
|
|
55
35
|
"access": "public",
|
|
56
36
|
"registry": "https://registry.npmjs.org"
|
|
57
37
|
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@weiliang0121/capix-transcript": "0.3.0"
|
|
40
|
+
},
|
|
58
41
|
"scripts": {
|
|
59
42
|
"build": "tsc -p tsconfig.json",
|
|
60
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
43
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
44
|
+
"test": "node ../../scripts/test/run.mjs --package ."
|
|
61
45
|
}
|
|
62
46
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Message } from './message.js';
|
|
2
|
-
import type { MemoryContent, MemoryResultSource } from './memory.js';
|
|
3
|
-
import type { InvocationOrigin } from '../invocation/types.js';
|
|
4
|
-
export type TranscriptEvent = Readonly<{
|
|
5
|
-
type: 'transcript';
|
|
6
|
-
transcriptId: string;
|
|
7
|
-
revision: number;
|
|
8
|
-
occurredAt: string;
|
|
9
|
-
origin?: InvocationOrigin;
|
|
10
|
-
change: Readonly<{
|
|
11
|
-
kind: 'messages-appended';
|
|
12
|
-
start: number;
|
|
13
|
-
messages: readonly Readonly<Message>[];
|
|
14
|
-
}> | Readonly<{
|
|
15
|
-
kind: 'segment-started';
|
|
16
|
-
previousStart: number;
|
|
17
|
-
start: number;
|
|
18
|
-
end: number;
|
|
19
|
-
}>;
|
|
20
|
-
}>;
|
|
21
|
-
export type MemoryEvent = Readonly<{
|
|
22
|
-
type: 'memory';
|
|
23
|
-
memoriesId: string;
|
|
24
|
-
sequence: number;
|
|
25
|
-
occurredAt: string;
|
|
26
|
-
origin?: InvocationOrigin;
|
|
27
|
-
change: Readonly<{
|
|
28
|
-
action: 'create' | 'update';
|
|
29
|
-
memoryId: string;
|
|
30
|
-
explanation: string;
|
|
31
|
-
sourceIndexes: readonly number[];
|
|
32
|
-
sourceResults?: readonly MemoryResultSource[];
|
|
33
|
-
result: MemoryContent;
|
|
34
|
-
}>;
|
|
35
|
-
}>;
|
package/dist/content/changes.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
package/dist/content/index.d.ts
DELETED
package/dist/content/index.js
DELETED
package/dist/content/memory.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { FileReceipt } from '../conversation/files.js';
|
|
2
|
-
export interface MemoryResultSource {
|
|
3
|
-
readonly id: string;
|
|
4
|
-
readonly kind: 'file-created';
|
|
5
|
-
readonly answerIndex: number;
|
|
6
|
-
readonly receipt: FileReceipt;
|
|
7
|
-
}
|
|
8
|
-
export interface MemoryContent {
|
|
9
|
-
readonly topic: string;
|
|
10
|
-
readonly content: string;
|
|
11
|
-
readonly sourceIndexes: readonly number[];
|
|
12
|
-
readonly sourceResults?: readonly MemoryResultSource[];
|
|
13
|
-
}
|
package/dist/content/memory.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
package/dist/content/message.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Message } from './message.js';
|
|
2
|
-
import type { TranscriptEvent } from './changes.js';
|
|
3
|
-
export interface MessageLocator {
|
|
4
|
-
readonly transcriptId: string;
|
|
5
|
-
readonly index: number;
|
|
6
|
-
}
|
|
7
|
-
export interface TranscriptRangeLocator {
|
|
8
|
-
readonly transcriptId: string;
|
|
9
|
-
readonly start: number;
|
|
10
|
-
readonly end: number;
|
|
11
|
-
readonly revision?: number;
|
|
12
|
-
}
|
|
13
|
-
export interface TranscriptSnapshot {
|
|
14
|
-
readonly id: string;
|
|
15
|
-
readonly revision: number;
|
|
16
|
-
readonly start: 0;
|
|
17
|
-
readonly end: number;
|
|
18
|
-
readonly starts: readonly number[];
|
|
19
|
-
readonly messages: readonly Readonly<Message>[];
|
|
20
|
-
}
|
|
21
|
-
export type TranscriptFrame = {
|
|
22
|
-
readonly type: 'baseline';
|
|
23
|
-
readonly snapshot: TranscriptSnapshot;
|
|
24
|
-
} | {
|
|
25
|
-
readonly type: 'delta';
|
|
26
|
-
readonly event: TranscriptEvent;
|
|
27
|
-
};
|
|
28
|
-
export type TranscriptUpdate = TranscriptFrame | {
|
|
29
|
-
readonly type: 'error';
|
|
30
|
-
readonly code: string;
|
|
31
|
-
readonly error: string;
|
|
32
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { CallableKind, InvocationProcessStage, InvocationRelationPhase } from '../invocation/types.js';
|
|
2
|
-
import type { ConversationFailure } from './delivery.js';
|
|
3
|
-
export interface ConversationStage {
|
|
4
|
-
readonly contextId: string;
|
|
5
|
-
readonly kind: 'model' | 'tool';
|
|
6
|
-
readonly label: string;
|
|
7
|
-
readonly status: 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
8
|
-
}
|
|
9
|
-
export interface ConversationActivity {
|
|
10
|
-
readonly contextId: string;
|
|
11
|
-
readonly parentContextId?: string;
|
|
12
|
-
readonly kind: CallableKind;
|
|
13
|
-
readonly label: string;
|
|
14
|
-
readonly status: 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
15
|
-
readonly phase: 'setup' | InvocationProcessStage;
|
|
16
|
-
readonly round: number;
|
|
17
|
-
readonly startedAt?: string;
|
|
18
|
-
readonly finishedAt?: string;
|
|
19
|
-
readonly relation?: {
|
|
20
|
-
readonly phase: InvocationRelationPhase;
|
|
21
|
-
readonly returned?: 'succeeded' | 'failed' | 'cancelled';
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export interface ConversationActivities {
|
|
25
|
-
readonly calls: readonly ConversationActivity[];
|
|
26
|
-
readonly integrity: {
|
|
27
|
-
readonly status: 'complete';
|
|
28
|
-
} | {
|
|
29
|
-
readonly status: 'incomplete';
|
|
30
|
-
readonly error: ConversationFailure;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface ConversationActivityChange {
|
|
34
|
-
readonly calls?: readonly ConversationActivity[];
|
|
35
|
-
readonly integrity?: ConversationActivities['integrity'];
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface ConversationDescriptor {
|
|
2
|
-
readonly id: string;
|
|
3
|
-
readonly title: string;
|
|
4
|
-
readonly transcriptId: string;
|
|
5
|
-
readonly createdAt: number;
|
|
6
|
-
readonly updatedAt: number;
|
|
7
|
-
}
|
|
8
|
-
export interface ConversationListResponse {
|
|
9
|
-
readonly conversations: readonly ConversationDescriptor[];
|
|
10
|
-
readonly defaultConversationId: string;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import type { Message } from '../content/message.js';
|
|
2
|
-
import type { ModelSettings } from './settings.js';
|
|
3
|
-
import type { MessageLocator, TranscriptRangeLocator, TranscriptSnapshot } from '../content/transcript.js';
|
|
4
|
-
import type { ConversationActivities, ConversationActivityChange, ConversationStage } from './activity.js';
|
|
5
|
-
import type { FileTask, FileOutput } from './files.js';
|
|
6
|
-
import type { ConversationTask } from './task.js';
|
|
7
|
-
export interface ConversationFailure {
|
|
8
|
-
readonly code: string;
|
|
9
|
-
readonly message: string;
|
|
10
|
-
}
|
|
11
|
-
export type ConversationAdmission = {
|
|
12
|
-
readonly conversationId: string;
|
|
13
|
-
readonly transcriptId: string;
|
|
14
|
-
} & ({
|
|
15
|
-
readonly status: 'ready';
|
|
16
|
-
} | {
|
|
17
|
-
readonly status: 'busy';
|
|
18
|
-
} | {
|
|
19
|
-
readonly status: 'unavailable';
|
|
20
|
-
readonly error: ConversationFailure;
|
|
21
|
-
});
|
|
22
|
-
export interface ConversationSubmissionRequest {
|
|
23
|
-
readonly conversationId: string;
|
|
24
|
-
readonly submissionId: string;
|
|
25
|
-
readonly input: ConversationRequest;
|
|
26
|
-
}
|
|
27
|
-
export interface ConversationSubmissionSnapshot {
|
|
28
|
-
readonly conversationId: string;
|
|
29
|
-
readonly submissionId: string;
|
|
30
|
-
readonly revision: number;
|
|
31
|
-
readonly input?: TranscriptRangeLocator;
|
|
32
|
-
readonly answer?: MessageLocator;
|
|
33
|
-
readonly executions: readonly {
|
|
34
|
-
readonly contextId: string;
|
|
35
|
-
}[];
|
|
36
|
-
readonly activities?: ConversationActivities;
|
|
37
|
-
readonly stage?: ConversationStage;
|
|
38
|
-
readonly task?: ConversationTask;
|
|
39
|
-
readonly fileOutput?: FileOutput;
|
|
40
|
-
readonly cancelRequested?: true;
|
|
41
|
-
readonly admission?: ConversationAdmission;
|
|
42
|
-
readonly result?: {
|
|
43
|
-
readonly status: 'completed' | 'cancelled';
|
|
44
|
-
} | {
|
|
45
|
-
readonly status: 'failed';
|
|
46
|
-
readonly error: ConversationFailure;
|
|
47
|
-
} | {
|
|
48
|
-
readonly status: 'rejected';
|
|
49
|
-
readonly error: ConversationFailure;
|
|
50
|
-
readonly retry?: 'admission';
|
|
51
|
-
};
|
|
52
|
-
readonly integrity: {
|
|
53
|
-
readonly status: 'complete';
|
|
54
|
-
} | {
|
|
55
|
-
readonly status: 'incomplete';
|
|
56
|
-
readonly error: ConversationFailure;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export interface ConversationSubmissionChange {
|
|
60
|
-
readonly input?: TranscriptRangeLocator;
|
|
61
|
-
readonly answer?: MessageLocator;
|
|
62
|
-
readonly executions?: readonly {
|
|
63
|
-
readonly contextId: string;
|
|
64
|
-
}[];
|
|
65
|
-
readonly activities?: ConversationActivityChange;
|
|
66
|
-
readonly stage?: ConversationStage;
|
|
67
|
-
readonly task?: ConversationTask;
|
|
68
|
-
readonly fileOutput?: FileOutput;
|
|
69
|
-
readonly cancelRequested?: true;
|
|
70
|
-
readonly admission?: ConversationAdmission | null;
|
|
71
|
-
readonly result?: ConversationSubmissionSnapshot['result'];
|
|
72
|
-
readonly integrity?: ConversationSubmissionSnapshot['integrity'];
|
|
73
|
-
}
|
|
74
|
-
export interface ConversationSubmissionUpdate {
|
|
75
|
-
readonly type: 'submission';
|
|
76
|
-
readonly conversationId: string;
|
|
77
|
-
readonly submissionId: string;
|
|
78
|
-
readonly fromRevision: number;
|
|
79
|
-
readonly revision: number;
|
|
80
|
-
readonly change: ConversationSubmissionChange;
|
|
81
|
-
}
|
|
82
|
-
export interface ConversationRequest {
|
|
83
|
-
messages: Message[];
|
|
84
|
-
contextBudget?: number;
|
|
85
|
-
fileTask?: FileTask;
|
|
86
|
-
}
|
|
87
|
-
export interface ConfigurationResponse extends ModelSettings {
|
|
88
|
-
configured: boolean;
|
|
89
|
-
files?: {
|
|
90
|
-
readonly maxReadBytes: number;
|
|
91
|
-
readonly maxWriteBytes: number;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
export interface TranscriptResponse extends TranscriptSnapshot {
|
|
95
|
-
}
|
|
96
|
-
export interface ErrorResponse {
|
|
97
|
-
error: string;
|
|
98
|
-
code?: string;
|
|
99
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type FileTask = {
|
|
2
|
-
readonly sourcePath: string;
|
|
3
|
-
readonly output?: {
|
|
4
|
-
readonly path: string;
|
|
5
|
-
};
|
|
6
|
-
} | {
|
|
7
|
-
readonly sourcePath?: never;
|
|
8
|
-
readonly output: {
|
|
9
|
-
readonly path: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export interface FileReceipt {
|
|
13
|
-
readonly path: string;
|
|
14
|
-
readonly bytes: number;
|
|
15
|
-
readonly digest: string;
|
|
16
|
-
}
|
|
17
|
-
export type FileOutput = {
|
|
18
|
-
readonly status: 'pending';
|
|
19
|
-
readonly path: string;
|
|
20
|
-
} | {
|
|
21
|
-
readonly status: 'created';
|
|
22
|
-
readonly receipt: FileReceipt;
|
|
23
|
-
} | {
|
|
24
|
-
readonly status: 'not-created';
|
|
25
|
-
readonly path: string;
|
|
26
|
-
readonly reason: 'not-started' | 'cancelled' | 'failed';
|
|
27
|
-
} | {
|
|
28
|
-
readonly status: 'unconfirmed';
|
|
29
|
-
readonly path: string;
|
|
30
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './delivery.js';
|
|
2
|
-
export * from './conversation.js';
|
|
3
|
-
export * from './settings.js';
|
|
4
|
-
export * from './generation.js';
|
|
5
|
-
export * from './activity.js';
|
|
6
|
-
export * from './files.js';
|
|
7
|
-
export * from './task.js';
|
|
8
|
-
export * from './preview.js';
|
|
9
|
-
export * from './service.js';
|
|
10
|
-
export * from './recovery.js';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
2
|
-
export*from"./delivery.js";export*from"./conversation.js";export*from"./settings.js";export*from"./generation.js";export*from"./activity.js";export*from"./files.js";export*from"./task.js";export*from"./preview.js";export*from"./service.js";export*from"./recovery.js";
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { MessageLocator } from '../content/transcript.js';
|
|
2
|
-
import type { ConversationSubmissionSnapshot, ConversationSubmissionUpdate } from './delivery.js';
|
|
3
|
-
export interface AnswerPreviewSnapshot {
|
|
4
|
-
readonly generation: number;
|
|
5
|
-
readonly revision: number;
|
|
6
|
-
readonly text: string;
|
|
7
|
-
readonly state: 'streaming' | 'received' | 'committed' | 'discarded';
|
|
8
|
-
readonly message?: MessageLocator;
|
|
9
|
-
readonly consistency?: 'complete' | 'prefix' | 'mismatch';
|
|
10
|
-
readonly reason?: 'rejected' | 'failed' | 'cancelled';
|
|
11
|
-
}
|
|
12
|
-
export type AnswerPreviewChange = {
|
|
13
|
-
readonly generation: number;
|
|
14
|
-
readonly revision: number;
|
|
15
|
-
} & ({
|
|
16
|
-
readonly kind: 'started';
|
|
17
|
-
} | {
|
|
18
|
-
readonly kind: 'appended';
|
|
19
|
-
readonly offset: number;
|
|
20
|
-
readonly text: string;
|
|
21
|
-
} | {
|
|
22
|
-
readonly kind: 'received';
|
|
23
|
-
} | {
|
|
24
|
-
readonly kind: 'committed';
|
|
25
|
-
readonly message: MessageLocator;
|
|
26
|
-
readonly consistency: 'complete' | 'prefix' | 'mismatch';
|
|
27
|
-
} | {
|
|
28
|
-
readonly kind: 'discarded';
|
|
29
|
-
readonly reason: 'rejected' | 'failed' | 'cancelled';
|
|
30
|
-
});
|
|
31
|
-
export interface ConversationSubmissionBaseline {
|
|
32
|
-
readonly type: 'baseline';
|
|
33
|
-
readonly submission: ConversationSubmissionSnapshot;
|
|
34
|
-
readonly preview?: AnswerPreviewSnapshot;
|
|
35
|
-
}
|
|
36
|
-
export interface ConversationSubmissionDiscovery {
|
|
37
|
-
readonly conversationId: string;
|
|
38
|
-
readonly transcriptId: string;
|
|
39
|
-
readonly submission?: ConversationSubmissionBaseline;
|
|
40
|
-
}
|
|
41
|
-
export type ConversationSubmissionFrame = ConversationSubmissionBaseline | ConversationSubmissionUpdate | {
|
|
42
|
-
readonly type: 'answer';
|
|
43
|
-
readonly conversationId: string;
|
|
44
|
-
readonly submissionId: string;
|
|
45
|
-
readonly change: AnswerPreviewChange;
|
|
46
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface ConversationRecoverySummary {
|
|
2
|
-
readonly contextId: string;
|
|
3
|
-
readonly point: string;
|
|
4
|
-
readonly available: boolean;
|
|
5
|
-
readonly eligibility?: 'unchecked';
|
|
6
|
-
readonly reason?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ConversationRecoveryRequest {
|
|
9
|
-
readonly conversationId: string;
|
|
10
|
-
readonly submissionId: string;
|
|
11
|
-
readonly contextId: string;
|
|
12
|
-
}
|
|
13
|
-
export interface ConversationRecoveryEvent {
|
|
14
|
-
readonly entryId: string;
|
|
15
|
-
readonly activityId: string;
|
|
16
|
-
readonly contextId: string;
|
|
17
|
-
readonly parentContextId?: string;
|
|
18
|
-
readonly structureKind: 'scene' | 'group' | 'node';
|
|
19
|
-
readonly sequence: number;
|
|
20
|
-
readonly occurredAt: string;
|
|
21
|
-
readonly kind: 'captured' | 'saved' | 'checking' | 'continued' | 'installed' | 'child-restored' | 'activity' | 'resource' | 'transcript' | 'memory' | 'failed' | 'finishing' | 'finished';
|
|
22
|
-
readonly point?: string;
|
|
23
|
-
readonly stage?: string;
|
|
24
|
-
readonly status?: 'succeeded' | 'failed' | 'cancelled';
|
|
25
|
-
}
|
|
26
|
-
export interface ConversationRecoveryActivity {
|
|
27
|
-
readonly complete: boolean;
|
|
28
|
-
readonly events: readonly ConversationRecoveryEvent[];
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|