@linnlabs/linnkit 0.43.0 → 0.45.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/CHANGELOG.md +61 -0
- package/dist/cli.cjs +152 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +152 -6
- package/dist/cli.js.map +1 -1
- package/dist/context-manager/profiles/agent/context/config.d.cts +1 -1
- package/dist/context-manager/profiles/agent/context/config.d.ts +1 -1
- package/dist/context-manager.cjs +37 -4
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.js +37 -4
- package/dist/context-manager.js.map +1 -1
- package/dist/contracts/agentSpec.d.cts +5 -5
- package/dist/contracts/agentSpec.d.ts +5 -5
- package/dist/contracts/audit.d.cts +10 -10
- package/dist/contracts/audit.d.ts +10 -10
- package/dist/contracts/contextPolicy.d.cts +14 -14
- package/dist/contracts/contextPolicy.d.ts +14 -14
- package/dist/contracts/events.d.cts +121 -117
- package/dist/contracts/events.d.ts +121 -117
- package/dist/contracts/execution.d.cts +2 -2
- package/dist/contracts/execution.d.ts +2 -2
- package/dist/contracts/llm-retry.d.cts +2 -2
- package/dist/contracts/llm-retry.d.ts +2 -2
- package/dist/contracts/messages.d.cts +256 -32
- package/dist/contracts/messages.d.ts +256 -32
- package/dist/contracts/sse.d.cts +161 -97
- package/dist/contracts/sse.d.ts +161 -97
- package/dist/contracts/sub-run-trace-payload.d.cts +8 -8
- package/dist/contracts/sub-run-trace-payload.d.ts +8 -8
- package/dist/contracts/token-accounting.d.cts +12 -12
- package/dist/contracts/token-accounting.d.ts +12 -12
- package/dist/contracts.cjs +19 -2
- package/dist/contracts.cjs.map +1 -1
- package/dist/contracts.d.cts +1 -1
- package/dist/contracts.d.ts +1 -1
- package/dist/contracts.js +19 -3
- package/dist/contracts.js.map +1 -1
- package/dist/index.cjs +154 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +154 -6
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +152 -6
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +152 -6
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/events/agentEvents.d.cts +2 -2
- package/dist/runtime-kernel/events/agentEvents.d.ts +2 -2
- package/dist/runtime-kernel/events.cjs +29 -2
- package/dist/runtime-kernel/events.cjs.map +1 -1
- package/dist/runtime-kernel/events.js +29 -2
- package/dist/runtime-kernel/events.js.map +1 -1
- package/dist/runtime-kernel/graph-engine/definitions/pendingUserInput.d.cts +27 -0
- package/dist/runtime-kernel/graph-engine/definitions/pendingUserInput.d.ts +27 -0
- package/dist/runtime-kernel/graph-engine/engine.d.cts +1 -1
- package/dist/runtime-kernel/graph-engine/engine.d.ts +1 -1
- package/dist/runtime-kernel/graph-engine/index.d.cts +1 -0
- package/dist/runtime-kernel/graph-engine/index.d.ts +1 -0
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.cts +3 -0
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.ts +3 -0
- package/dist/runtime-kernel/graph-engine/types.d.cts +3 -0
- package/dist/runtime-kernel/graph-engine/types.d.ts +3 -0
- package/dist/runtime-kernel.cjs +152 -6
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.d.cts +1 -0
- package/dist/runtime-kernel.d.ts +1 -0
- package/dist/runtime-kernel.js +152 -6
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit/agent-harness/scriptedInferenceHarness.d.cts +24 -6
- package/dist/testkit/agent-harness/scriptedInferenceHarness.d.ts +24 -6
- package/dist/testkit/scenario/graphScenario.d.cts +89 -0
- package/dist/testkit/scenario/graphScenario.d.ts +89 -0
- package/dist/testkit/scenario/pendingUserInputQueue.d.cts +26 -0
- package/dist/testkit/scenario/pendingUserInputQueue.d.ts +26 -0
- package/dist/testkit/scenario/runtimeEventRecorder.d.cts +36 -0
- package/dist/testkit/scenario/runtimeEventRecorder.d.ts +36 -0
- package/dist/testkit/scenario/scriptedToolRuntime.d.cts +51 -0
- package/dist/testkit/scenario/scriptedToolRuntime.d.ts +51 -0
- package/dist/testkit/scenario/steeringInvariants.d.cts +33 -0
- package/dist/testkit/scenario/steeringInvariants.d.ts +33 -0
- package/dist/testkit/scenario/timeline.d.cts +27 -0
- package/dist/testkit/scenario/timeline.d.ts +27 -0
- package/dist/testkit.cjs +722 -19
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.d.cts +7 -1
- package/dist/testkit.d.ts +7 -1
- package/dist/testkit.js +714 -20
- package/dist/testkit.js.map +1 -1
- package/docs/integration/README.md +1 -0
- package/docs/integration/mid-run-user-input.md +73 -0
- package/docs/integration/realtime.md +4 -0
- package/docs/integration/run-supervisor.md +1 -0
- package/docs/integration/testing.md +40 -4
- package/package.json +2 -2
|
@@ -9,14 +9,14 @@ import { SerializableJsonValue } from './json.cjs';
|
|
|
9
9
|
*/
|
|
10
10
|
declare const SubRunTraceKind: z.ZodEnum<{
|
|
11
11
|
error: "error";
|
|
12
|
-
history_summary: "history_summary";
|
|
13
|
-
final_answer: "final_answer";
|
|
14
|
-
tool_output: "tool_output";
|
|
15
12
|
tool_call_decision: "tool_call_decision";
|
|
16
13
|
tool_process: "tool_process";
|
|
14
|
+
tool_output: "tool_output";
|
|
17
15
|
thought_delta: "thought_delta";
|
|
18
16
|
thought_complete: "thought_complete";
|
|
19
17
|
final_answer_chunk: "final_answer_chunk";
|
|
18
|
+
final_answer: "final_answer";
|
|
19
|
+
history_summary: "history_summary";
|
|
20
20
|
llm_retry: "llm_retry";
|
|
21
21
|
}>;
|
|
22
22
|
type SubRunTraceKind = z.infer<typeof SubRunTraceKind>;
|
|
@@ -33,25 +33,25 @@ declare const SubRunTracePayload: z.ZodObject<{
|
|
|
33
33
|
source_event_id: z.ZodString;
|
|
34
34
|
kind: z.ZodEnum<{
|
|
35
35
|
error: "error";
|
|
36
|
-
history_summary: "history_summary";
|
|
37
|
-
final_answer: "final_answer";
|
|
38
|
-
tool_output: "tool_output";
|
|
39
36
|
tool_call_decision: "tool_call_decision";
|
|
40
37
|
tool_process: "tool_process";
|
|
38
|
+
tool_output: "tool_output";
|
|
41
39
|
thought_delta: "thought_delta";
|
|
42
40
|
thought_complete: "thought_complete";
|
|
43
41
|
final_answer_chunk: "final_answer_chunk";
|
|
42
|
+
final_answer: "final_answer";
|
|
43
|
+
history_summary: "history_summary";
|
|
44
44
|
llm_retry: "llm_retry";
|
|
45
45
|
}>;
|
|
46
46
|
retry: z.ZodOptional<z.ZodObject<{
|
|
47
47
|
retry_id: z.ZodString;
|
|
48
48
|
status: z.ZodEnum<{
|
|
49
|
-
failed: "failed";
|
|
50
|
-
cancelled: "cancelled";
|
|
51
49
|
waiting: "waiting";
|
|
52
50
|
retrying: "retrying";
|
|
53
51
|
succeeded: "succeeded";
|
|
54
52
|
exhausted: "exhausted";
|
|
53
|
+
failed: "failed";
|
|
54
|
+
cancelled: "cancelled";
|
|
55
55
|
}>;
|
|
56
56
|
category: z.ZodEnum<{
|
|
57
57
|
output: "output";
|
|
@@ -9,14 +9,14 @@ import { SerializableJsonValue } from './json.js';
|
|
|
9
9
|
*/
|
|
10
10
|
declare const SubRunTraceKind: z.ZodEnum<{
|
|
11
11
|
error: "error";
|
|
12
|
-
history_summary: "history_summary";
|
|
13
|
-
final_answer: "final_answer";
|
|
14
|
-
tool_output: "tool_output";
|
|
15
12
|
tool_call_decision: "tool_call_decision";
|
|
16
13
|
tool_process: "tool_process";
|
|
14
|
+
tool_output: "tool_output";
|
|
17
15
|
thought_delta: "thought_delta";
|
|
18
16
|
thought_complete: "thought_complete";
|
|
19
17
|
final_answer_chunk: "final_answer_chunk";
|
|
18
|
+
final_answer: "final_answer";
|
|
19
|
+
history_summary: "history_summary";
|
|
20
20
|
llm_retry: "llm_retry";
|
|
21
21
|
}>;
|
|
22
22
|
type SubRunTraceKind = z.infer<typeof SubRunTraceKind>;
|
|
@@ -33,25 +33,25 @@ declare const SubRunTracePayload: z.ZodObject<{
|
|
|
33
33
|
source_event_id: z.ZodString;
|
|
34
34
|
kind: z.ZodEnum<{
|
|
35
35
|
error: "error";
|
|
36
|
-
history_summary: "history_summary";
|
|
37
|
-
final_answer: "final_answer";
|
|
38
|
-
tool_output: "tool_output";
|
|
39
36
|
tool_call_decision: "tool_call_decision";
|
|
40
37
|
tool_process: "tool_process";
|
|
38
|
+
tool_output: "tool_output";
|
|
41
39
|
thought_delta: "thought_delta";
|
|
42
40
|
thought_complete: "thought_complete";
|
|
43
41
|
final_answer_chunk: "final_answer_chunk";
|
|
42
|
+
final_answer: "final_answer";
|
|
43
|
+
history_summary: "history_summary";
|
|
44
44
|
llm_retry: "llm_retry";
|
|
45
45
|
}>;
|
|
46
46
|
retry: z.ZodOptional<z.ZodObject<{
|
|
47
47
|
retry_id: z.ZodString;
|
|
48
48
|
status: z.ZodEnum<{
|
|
49
|
-
failed: "failed";
|
|
50
|
-
cancelled: "cancelled";
|
|
51
49
|
waiting: "waiting";
|
|
52
50
|
retrying: "retrying";
|
|
53
51
|
succeeded: "succeeded";
|
|
54
52
|
exhausted: "exhausted";
|
|
53
|
+
failed: "failed";
|
|
54
|
+
cancelled: "cancelled";
|
|
55
55
|
}>;
|
|
56
56
|
category: z.ZodEnum<{
|
|
57
57
|
output: "output";
|
|
@@ -6,11 +6,11 @@ declare const TokenLedgerEntryKind: z.ZodEnum<{
|
|
|
6
6
|
}>;
|
|
7
7
|
type TokenLedgerEntryKind = z.infer<typeof TokenLedgerEntryKind>;
|
|
8
8
|
declare const ContextTokenComponentKind: z.ZodEnum<{
|
|
9
|
-
system: "system";
|
|
10
9
|
user: "user";
|
|
11
|
-
|
|
12
|
-
tool: "tool";
|
|
10
|
+
system: "system";
|
|
13
11
|
other: "other";
|
|
12
|
+
tool: "tool";
|
|
13
|
+
assistant: "assistant";
|
|
14
14
|
"context-injection": "context-injection";
|
|
15
15
|
"history-summary": "history-summary";
|
|
16
16
|
"working-memory": "working-memory";
|
|
@@ -33,11 +33,11 @@ type TokenUsageTotals = z.infer<typeof TokenUsageTotals>;
|
|
|
33
33
|
declare const ContextTokenComponent: z.ZodObject<{
|
|
34
34
|
componentId: z.ZodString;
|
|
35
35
|
kind: z.ZodEnum<{
|
|
36
|
-
system: "system";
|
|
37
36
|
user: "user";
|
|
38
|
-
|
|
39
|
-
tool: "tool";
|
|
37
|
+
system: "system";
|
|
40
38
|
other: "other";
|
|
39
|
+
tool: "tool";
|
|
40
|
+
assistant: "assistant";
|
|
41
41
|
"context-injection": "context-injection";
|
|
42
42
|
"history-summary": "history-summary";
|
|
43
43
|
"working-memory": "working-memory";
|
|
@@ -149,11 +149,11 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
149
149
|
components: z.ZodArray<z.ZodObject<{
|
|
150
150
|
componentId: z.ZodString;
|
|
151
151
|
kind: z.ZodEnum<{
|
|
152
|
-
system: "system";
|
|
153
152
|
user: "user";
|
|
154
|
-
|
|
155
|
-
tool: "tool";
|
|
153
|
+
system: "system";
|
|
156
154
|
other: "other";
|
|
155
|
+
tool: "tool";
|
|
156
|
+
assistant: "assistant";
|
|
157
157
|
"context-injection": "context-injection";
|
|
158
158
|
"history-summary": "history-summary";
|
|
159
159
|
"working-memory": "working-memory";
|
|
@@ -265,11 +265,11 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
265
265
|
components: z.ZodArray<z.ZodObject<{
|
|
266
266
|
componentId: z.ZodString;
|
|
267
267
|
kind: z.ZodEnum<{
|
|
268
|
-
system: "system";
|
|
269
268
|
user: "user";
|
|
270
|
-
|
|
271
|
-
tool: "tool";
|
|
269
|
+
system: "system";
|
|
272
270
|
other: "other";
|
|
271
|
+
tool: "tool";
|
|
272
|
+
assistant: "assistant";
|
|
273
273
|
"context-injection": "context-injection";
|
|
274
274
|
"history-summary": "history-summary";
|
|
275
275
|
"working-memory": "working-memory";
|
|
@@ -6,11 +6,11 @@ declare const TokenLedgerEntryKind: z.ZodEnum<{
|
|
|
6
6
|
}>;
|
|
7
7
|
type TokenLedgerEntryKind = z.infer<typeof TokenLedgerEntryKind>;
|
|
8
8
|
declare const ContextTokenComponentKind: z.ZodEnum<{
|
|
9
|
-
system: "system";
|
|
10
9
|
user: "user";
|
|
11
|
-
|
|
12
|
-
tool: "tool";
|
|
10
|
+
system: "system";
|
|
13
11
|
other: "other";
|
|
12
|
+
tool: "tool";
|
|
13
|
+
assistant: "assistant";
|
|
14
14
|
"context-injection": "context-injection";
|
|
15
15
|
"history-summary": "history-summary";
|
|
16
16
|
"working-memory": "working-memory";
|
|
@@ -33,11 +33,11 @@ type TokenUsageTotals = z.infer<typeof TokenUsageTotals>;
|
|
|
33
33
|
declare const ContextTokenComponent: z.ZodObject<{
|
|
34
34
|
componentId: z.ZodString;
|
|
35
35
|
kind: z.ZodEnum<{
|
|
36
|
-
system: "system";
|
|
37
36
|
user: "user";
|
|
38
|
-
|
|
39
|
-
tool: "tool";
|
|
37
|
+
system: "system";
|
|
40
38
|
other: "other";
|
|
39
|
+
tool: "tool";
|
|
40
|
+
assistant: "assistant";
|
|
41
41
|
"context-injection": "context-injection";
|
|
42
42
|
"history-summary": "history-summary";
|
|
43
43
|
"working-memory": "working-memory";
|
|
@@ -149,11 +149,11 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
149
149
|
components: z.ZodArray<z.ZodObject<{
|
|
150
150
|
componentId: z.ZodString;
|
|
151
151
|
kind: z.ZodEnum<{
|
|
152
|
-
system: "system";
|
|
153
152
|
user: "user";
|
|
154
|
-
|
|
155
|
-
tool: "tool";
|
|
153
|
+
system: "system";
|
|
156
154
|
other: "other";
|
|
155
|
+
tool: "tool";
|
|
156
|
+
assistant: "assistant";
|
|
157
157
|
"context-injection": "context-injection";
|
|
158
158
|
"history-summary": "history-summary";
|
|
159
159
|
"working-memory": "working-memory";
|
|
@@ -265,11 +265,11 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
265
265
|
components: z.ZodArray<z.ZodObject<{
|
|
266
266
|
componentId: z.ZodString;
|
|
267
267
|
kind: z.ZodEnum<{
|
|
268
|
-
system: "system";
|
|
269
268
|
user: "user";
|
|
270
|
-
|
|
271
|
-
tool: "tool";
|
|
269
|
+
system: "system";
|
|
272
270
|
other: "other";
|
|
271
|
+
tool: "tool";
|
|
272
|
+
assistant: "assistant";
|
|
273
273
|
"context-injection": "context-injection";
|
|
274
274
|
"history-summary": "history-summary";
|
|
275
275
|
"working-memory": "working-memory";
|
package/dist/contracts.cjs
CHANGED
|
@@ -312,6 +312,10 @@ var UserInputMessage = BaseMessage.extend({
|
|
|
312
312
|
type: zod.z.literal("user_input"),
|
|
313
313
|
attachments: RuntimeResourceRefs.optional()
|
|
314
314
|
});
|
|
315
|
+
var UserSteerMessage = BaseMessage.extend({
|
|
316
|
+
role: zod.z.literal("user"),
|
|
317
|
+
type: zod.z.literal("user_steer")
|
|
318
|
+
});
|
|
315
319
|
var UserContextMessage = BaseMessage.extend({
|
|
316
320
|
role: zod.z.literal("user"),
|
|
317
321
|
// 产品上下文种类由 Host fence metadata 表达,不进入框架消息枚举。
|
|
@@ -320,7 +324,7 @@ var UserContextMessage = BaseMessage.extend({
|
|
|
320
324
|
"task_request"
|
|
321
325
|
])
|
|
322
326
|
});
|
|
323
|
-
var UserMessage = zod.z.union([UserInputMessage, UserContextMessage]);
|
|
327
|
+
var UserMessage = zod.z.union([UserInputMessage, UserSteerMessage, UserContextMessage]);
|
|
324
328
|
var AssistantMessage = BaseMessage.extend({
|
|
325
329
|
role: zod.z.literal("assistant"),
|
|
326
330
|
type: zod.z.enum(["thought", "final_answer", "tool_code", "tool_calls", "task_completion"])
|
|
@@ -1150,7 +1154,12 @@ var RuntimeEventShape = zod.z.discriminatedUnion("type", [
|
|
|
1150
1154
|
content: zod.z.string(),
|
|
1151
1155
|
raw_content: zod.z.string().optional(),
|
|
1152
1156
|
source: zod.z.enum(["user", "editor", "system"]).default("user"),
|
|
1153
|
-
attachments: RuntimeResourceRefs.optional()
|
|
1157
|
+
attachments: RuntimeResourceRefs.optional(),
|
|
1158
|
+
/**
|
|
1159
|
+
* 运行中途送达的用户输入(插话)。缺省表示运行起点的输入。
|
|
1160
|
+
* 上下文里投影为 `user_steer`,不改变“当前轮从哪条 user_input 开始”的判定。
|
|
1161
|
+
*/
|
|
1162
|
+
delivery: zod.z.literal("mid_run").optional()
|
|
1154
1163
|
}),
|
|
1155
1164
|
BaseEvent.extend({
|
|
1156
1165
|
type: zod.z.literal("thought"),
|
|
@@ -1641,6 +1650,11 @@ function parseSSEExecutionScope(event) {
|
|
|
1641
1650
|
execution_id: event.execution_id
|
|
1642
1651
|
});
|
|
1643
1652
|
}
|
|
1653
|
+
var SSEUserInputEvent = BaseSSEEvent.extend({
|
|
1654
|
+
type: zod.z.literal("user_input"),
|
|
1655
|
+
content: zod.z.string(),
|
|
1656
|
+
delivery: zod.z.literal("mid_run")
|
|
1657
|
+
});
|
|
1644
1658
|
var SSEThoughtEvent = BaseSSEEvent.extend({
|
|
1645
1659
|
type: zod.z.literal("thought"),
|
|
1646
1660
|
thought_message_id: ThoughtMessageIdSchema.optional(),
|
|
@@ -1795,6 +1809,7 @@ var SSESummarizationErrorEvent = BaseSSEEvent.extend({
|
|
|
1795
1809
|
error: zod.z.string()
|
|
1796
1810
|
});
|
|
1797
1811
|
var SSEEvent = zod.z.discriminatedUnion("type", [
|
|
1812
|
+
SSEUserInputEvent,
|
|
1798
1813
|
SSEThoughtEvent,
|
|
1799
1814
|
SSEFinalAnswerChunkEvent,
|
|
1800
1815
|
SSEFinalAnswerResetEvent,
|
|
@@ -1866,6 +1881,7 @@ function runtimeEventToSSEEvent(event) {
|
|
|
1866
1881
|
const base = toBaseSSEEvent(event);
|
|
1867
1882
|
switch (event.type) {
|
|
1868
1883
|
case "user_input":
|
|
1884
|
+
return event.delivery === "mid_run" ? { ...base, type: "user_input", content: event.raw_content ?? event.content, delivery: "mid_run" } : null;
|
|
1869
1885
|
case "audit_envelope":
|
|
1870
1886
|
case "control":
|
|
1871
1887
|
return null;
|
|
@@ -2559,6 +2575,7 @@ exports.SSEToolOutputEvent = SSEToolOutputEvent;
|
|
|
2559
2575
|
exports.SSEToolProcessEvent = SSEToolProcessEvent;
|
|
2560
2576
|
exports.SSETransportEndEvent = SSETransportEndEvent;
|
|
2561
2577
|
exports.SSETransportErrorEvent = SSETransportErrorEvent;
|
|
2578
|
+
exports.SSEUserInputEvent = SSEUserInputEvent;
|
|
2562
2579
|
exports.SYSTEM_REMINDER_BUILTIN_TRIGGER_KINDS = SYSTEM_REMINDER_BUILTIN_TRIGGER_KINDS;
|
|
2563
2580
|
exports.SerializableJsonRecord = SerializableJsonRecord;
|
|
2564
2581
|
exports.SerializableJsonValue = SerializableJsonValue;
|