@weiliang0121/capix-protocol 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +23 -2
- package/dist/content/changes.d.ts +35 -0
- package/dist/content/changes.js +1 -0
- package/dist/content/index.d.ts +4 -0
- package/dist/content/index.js +2 -0
- package/dist/content/memory.d.ts +13 -0
- package/dist/content/memory.js +1 -0
- package/dist/content/message.d.ts +4 -0
- package/dist/content/message.js +1 -0
- package/dist/content/transcript.d.ts +32 -0
- package/dist/content/transcript.js +1 -0
- package/dist/conversation/activity.d.ts +36 -0
- package/dist/conversation/activity.js +1 -0
- package/dist/conversation/conversation.d.ts +11 -0
- package/dist/conversation/conversation.js +1 -0
- package/dist/conversation/delivery.d.ts +99 -0
- package/dist/conversation/delivery.js +1 -0
- package/dist/conversation/files.d.ts +30 -0
- package/dist/conversation/files.js +1 -0
- package/dist/conversation/generation.d.ts +4 -0
- package/dist/conversation/generation.js +1 -0
- package/dist/conversation/index.d.ts +10 -0
- package/dist/conversation/index.js +2 -0
- package/dist/conversation/preview.d.ts +46 -0
- package/dist/conversation/preview.js +1 -0
- package/dist/conversation/recovery.d.ts +29 -0
- package/dist/conversation/recovery.js +1 -0
- package/dist/conversation/service.d.ts +75 -0
- package/dist/conversation/service.js +1 -0
- package/dist/conversation/settings.d.ts +6 -0
- package/dist/conversation/settings.js +1 -0
- package/dist/conversation/task.d.ts +11 -0
- package/dist/conversation/task.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/invocation/changes.d.ts +28 -0
- package/dist/invocation/changes.js +1 -0
- package/dist/invocation/errors.d.ts +1 -0
- package/dist/invocation/errors.js +1 -0
- package/dist/invocation/index.d.ts +3 -0
- package/dist/invocation/index.js +2 -0
- package/dist/invocation/types.d.ts +16 -0
- package/dist/invocation/types.js +2 -0
- package/dist/observer/archive.d.ts +9 -0
- package/dist/observer/archive.js +2 -0
- package/dist/observer/changes.d.ts +4 -0
- package/dist/observer/changes.js +1 -0
- package/dist/observer/execution.d.ts +10 -0
- package/dist/observer/execution.js +1 -0
- package/dist/observer/index.d.ts +8 -0
- package/dist/observer/index.js +2 -0
- package/dist/observer/interaction.d.ts +31 -0
- package/dist/observer/interaction.js +1 -0
- package/dist/observer/memory.d.ts +13 -0
- package/dist/observer/memory.js +1 -0
- package/dist/observer/overview.d.ts +45 -0
- package/dist/observer/overview.js +1 -0
- package/dist/observer/selection.d.ts +19 -0
- package/dist/observer/selection.js +1 -0
- package/dist/observer/stream.d.ts +56 -0
- package/dist/observer/stream.js +1 -0
- package/dist/recording/changes.d.ts +43 -0
- package/dist/recording/changes.js +1 -0
- package/dist/recording/index.d.ts +7 -0
- package/dist/recording/index.js +2 -0
- package/dist/recording/invocation.d.ts +10 -0
- package/dist/recording/invocation.js +2 -0
- package/dist/recording/memory.d.ts +18 -0
- package/dist/recording/memory.js +1 -0
- package/dist/recording/resource.d.ts +10 -0
- package/dist/recording/resource.js +1 -0
- package/dist/recording/transcript.d.ts +19 -0
- package/dist/recording/transcript.js +1 -0
- package/dist/recording/types.d.ts +190 -0
- package/dist/recording/types.js +2 -0
- package/dist/recording/validate.d.ts +4 -0
- package/dist/recording/validate.js +2 -0
- package/package.json +59 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wei.liang (https://github.com/weiliang0121)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @weiliang0121/capix-protocol
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Serializable client/server protocol types for CAPiX.
|
|
4
|
+
|
|
5
|
+
ES modules and TypeScript declarations. Requires Node.js 22.23.2 or newer.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @weiliang0121/capix-protocol
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Public entry points
|
|
12
|
+
|
|
13
|
+
- `@weiliang0121/capix-protocol`
|
|
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`
|
|
19
|
+
|
|
20
|
+
This package is part of CAPiX. The npm distribution contains compiled JavaScript, type declarations, and this package's MIT license. Reference services and client applications are not included in this package or the initial npm release.
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
MIT. Copyright (c) 2026 wei.liang. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,10 @@
|
|
|
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';
|
|
@@ -0,0 +1,2 @@
|
|
|
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";
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { MemoryContent } from '../content/memory.js';
|
|
2
|
+
import type { MessageLocator } from '../content/transcript.js';
|
|
3
|
+
import type { CallableRecord, InvocationBoundaryRecord } from '../recording/types.js';
|
|
4
|
+
import type { ResourceRecord } from '../recording/resource.js';
|
|
5
|
+
import type { TranscriptRecord } from '../recording/transcript.js';
|
|
6
|
+
import type { MemoryRecord } from '../recording/memory.js';
|
|
7
|
+
import type { ConversationAdmission } from './delivery.js';
|
|
8
|
+
import type { ConversationSubmissionBaseline } from './preview.js';
|
|
9
|
+
export interface ConversationServiceInfo {
|
|
10
|
+
readonly conversationId: string;
|
|
11
|
+
readonly transcriptId: string;
|
|
12
|
+
readonly mode: 'demo' | 'live';
|
|
13
|
+
readonly answerMode?: 'material' | 'tools';
|
|
14
|
+
readonly model: string;
|
|
15
|
+
readonly admission: ConversationAdmission;
|
|
16
|
+
readonly active?: ConversationSubmissionBaseline;
|
|
17
|
+
}
|
|
18
|
+
export interface ConversationCallSummary {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly contextId: string;
|
|
21
|
+
readonly name?: string;
|
|
22
|
+
readonly status: 'running' | 'succeeded' | 'failed';
|
|
23
|
+
readonly startedAt?: string;
|
|
24
|
+
readonly input?: MessageLocator;
|
|
25
|
+
readonly answer?: MessageLocator;
|
|
26
|
+
}
|
|
27
|
+
export type ConversationRecordingState = {
|
|
28
|
+
readonly status: 'idle';
|
|
29
|
+
readonly recorderId?: never;
|
|
30
|
+
} | {
|
|
31
|
+
readonly status: 'recording' | 'stopping' | 'stopped';
|
|
32
|
+
readonly recorderId: string;
|
|
33
|
+
};
|
|
34
|
+
export interface ConversationInspection {
|
|
35
|
+
readonly transcriptId: string;
|
|
36
|
+
readonly memories: {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly sequence: number;
|
|
39
|
+
readonly items: readonly (MemoryContent & {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
})[];
|
|
42
|
+
};
|
|
43
|
+
readonly view: {
|
|
44
|
+
readonly revision: number;
|
|
45
|
+
readonly sources: Readonly<Record<'messages' | 'memories', {
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly scope: string;
|
|
48
|
+
}>>;
|
|
49
|
+
readonly members: readonly ({
|
|
50
|
+
readonly source: 'messages';
|
|
51
|
+
readonly key: number;
|
|
52
|
+
} | {
|
|
53
|
+
readonly source: 'memories';
|
|
54
|
+
readonly key: string;
|
|
55
|
+
})[];
|
|
56
|
+
};
|
|
57
|
+
readonly recording: ConversationRecordingState & {
|
|
58
|
+
readonly revision: number;
|
|
59
|
+
readonly integrity: 'intact' | 'incomplete';
|
|
60
|
+
readonly calls: readonly ConversationCallSummary[];
|
|
61
|
+
readonly omitted: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export interface ConversationCallDetail {
|
|
65
|
+
readonly recorderId: string;
|
|
66
|
+
readonly revision: number;
|
|
67
|
+
readonly integrity: 'intact' | 'incomplete';
|
|
68
|
+
readonly root: CallableRecord;
|
|
69
|
+
readonly calls: readonly CallableRecord[];
|
|
70
|
+
readonly resources: readonly ResourceRecord[];
|
|
71
|
+
readonly transcripts: readonly TranscriptRecord[];
|
|
72
|
+
readonly memories: readonly MemoryRecord[];
|
|
73
|
+
readonly boundaries: readonly InvocationBoundaryRecord[];
|
|
74
|
+
readonly truncated: boolean;
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InvocationFailureFact } from './errors.js';
|
|
2
|
+
import type { CallableKind, InvocationProcessStage, InvocationProcessAction, InvocationRelationIdentity, InvocationRelationPhase } from './types.js';
|
|
3
|
+
export type InvocationEvent = Readonly<{
|
|
4
|
+
type: 'invocation';
|
|
5
|
+
contextId: string;
|
|
6
|
+
parentContextId?: string;
|
|
7
|
+
kind: CallableKind;
|
|
8
|
+
sequence: number;
|
|
9
|
+
occurredAt: string;
|
|
10
|
+
change: Readonly<{
|
|
11
|
+
kind: 'started';
|
|
12
|
+
}> | Readonly<{
|
|
13
|
+
kind: 'process';
|
|
14
|
+
processSequence: number;
|
|
15
|
+
round: number;
|
|
16
|
+
stage: InvocationProcessStage;
|
|
17
|
+
action: InvocationProcessAction;
|
|
18
|
+
}> | Readonly<{
|
|
19
|
+
kind: 'relation';
|
|
20
|
+
identity: InvocationRelationIdentity;
|
|
21
|
+
phase: InvocationRelationPhase;
|
|
22
|
+
status?: 'succeeded' | 'failed';
|
|
23
|
+
failure?: InvocationFailureFact;
|
|
24
|
+
}> | Readonly<{
|
|
25
|
+
kind: 'finished';
|
|
26
|
+
status: 'succeeded' | 'failed';
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { RuntimeErrorDetail, RuntimeErrorValue, InvocationFailureFact } from '@weiliang0121/capix-contracts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { callableKinds, type CallableKind } from '@weiliang0121/capix-contracts';
|
|
2
|
+
export type LegacyInvocationLevel = 'runtime' | 'execution' | 'operation' | 'attempt';
|
|
3
|
+
export declare const invocationProcessStages: readonly ["execute", "receive", "handling", "control"];
|
|
4
|
+
export declare const invocationProcessActions: readonly ["start", "return", "throw", "continue", "unhandled", "stop"];
|
|
5
|
+
export type InvocationProcessStage = (typeof invocationProcessStages)[number];
|
|
6
|
+
export type InvocationProcessAction = (typeof invocationProcessActions)[number];
|
|
7
|
+
export interface InvocationRelationIdentity {
|
|
8
|
+
readonly parentContextId: string;
|
|
9
|
+
readonly childContextId: string;
|
|
10
|
+
readonly parentRound: number;
|
|
11
|
+
readonly key?: string;
|
|
12
|
+
}
|
|
13
|
+
export type InvocationRelationPhase = 'attached' | 'returned' | 'receiving' | 'accepted' | 'handled' | 'failed';
|
|
14
|
+
export interface InvocationOrigin {
|
|
15
|
+
readonly contextId: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
|
|
2
|
+
import{callableKinds}from"@weiliang0121/capix-contracts";const invocationProcessStages=["execute","receive","handling","control"],invocationProcessActions=["start","return","throw","continue","unhandled","stop"];export{callableKinds,invocationProcessActions,invocationProcessStages};
|