@linnlabs/linnkit 0.42.0 → 0.44.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 +64 -0
- package/dist/cli.cjs +113 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +113 -5
- 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/events.d.cts +4 -0
- package/dist/contracts/events.d.ts +4 -0
- package/dist/contracts/messages.d.cts +226 -2
- package/dist/contracts/messages.d.ts +226 -2
- package/dist/contracts/sse.d.cts +65 -1
- package/dist/contracts/sse.d.ts +65 -1
- 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 +115 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +115 -5
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +113 -5
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +113 -5
- package/dist/quickstart.js.map +1 -1
- 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 +2 -1
- package/dist/runtime-kernel/graph-engine/engine.d.ts +2 -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/types.d.cts +3 -0
- package/dist/runtime-kernel/graph-engine/types.d.ts +3 -0
- package/dist/runtime-kernel.cjs +113 -5
- 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 +113 -5
- 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 +683 -18
- 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 +675 -19
- 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/testing.md +40 -4
- package/docs/integration/tool-development-guide.md +1 -0
- package/package.json +2 -2
package/dist/contracts/sse.d.ts
CHANGED
|
@@ -37,6 +37,34 @@ declare const SSEExecutionScope: z.ZodObject<{
|
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
type SSEExecutionScope = z.infer<typeof SSEExecutionScope>;
|
|
39
39
|
declare function parseSSEExecutionScope(event: Pick<BaseSSEEvent, 'run_id' | 'execution_id'>): SSEExecutionScope;
|
|
40
|
+
/**
|
|
41
|
+
* 运行中途送达的用户输入(插话)。运行起点的用户输入由客户端自己先显示,不经 SSE 回传;
|
|
42
|
+
* 插话由 Host 在一批工具结算后写入,客户端只能从这里得知它送达的位置。
|
|
43
|
+
*/
|
|
44
|
+
declare const SSEUserInputEvent: z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
timestamp: z.ZodNumber;
|
|
47
|
+
conversation_id: z.ZodString;
|
|
48
|
+
turn_id: z.ZodString;
|
|
49
|
+
run_id: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "RunId", "out">>;
|
|
50
|
+
execution_id: z.ZodOptional<z.ZodString>;
|
|
51
|
+
lane: z.ZodOptional<z.ZodEnum<{
|
|
52
|
+
foreground: "foreground";
|
|
53
|
+
auxiliary: "auxiliary";
|
|
54
|
+
child: "child";
|
|
55
|
+
}>>;
|
|
56
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
57
|
+
conversation: "conversation";
|
|
58
|
+
"parent-trace": "parent-trace";
|
|
59
|
+
none: "none";
|
|
60
|
+
}>>;
|
|
61
|
+
execution_seq: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, SerializableJsonValue, z.core.$ZodTypeInternals<SerializableJsonValue, SerializableJsonValue>>>>;
|
|
63
|
+
type: z.ZodLiteral<"user_input">;
|
|
64
|
+
content: z.ZodString;
|
|
65
|
+
delivery: z.ZodLiteral<"mid_run">;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
type SSEUserInputEvent = z.infer<typeof SSEUserInputEvent>;
|
|
40
68
|
declare const SSEThoughtEvent: z.ZodObject<{
|
|
41
69
|
id: z.ZodString;
|
|
42
70
|
timestamp: z.ZodNumber;
|
|
@@ -827,6 +855,28 @@ declare const SSESummarizationErrorEvent: z.ZodObject<{
|
|
|
827
855
|
}, z.core.$strip>;
|
|
828
856
|
type SSESummarizationErrorEvent = z.infer<typeof SSESummarizationErrorEvent>;
|
|
829
857
|
declare const SSEEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
858
|
+
id: z.ZodString;
|
|
859
|
+
timestamp: z.ZodNumber;
|
|
860
|
+
conversation_id: z.ZodString;
|
|
861
|
+
turn_id: z.ZodString;
|
|
862
|
+
run_id: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "RunId", "out">>;
|
|
863
|
+
execution_id: z.ZodOptional<z.ZodString>;
|
|
864
|
+
lane: z.ZodOptional<z.ZodEnum<{
|
|
865
|
+
foreground: "foreground";
|
|
866
|
+
auxiliary: "auxiliary";
|
|
867
|
+
child: "child";
|
|
868
|
+
}>>;
|
|
869
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
870
|
+
conversation: "conversation";
|
|
871
|
+
"parent-trace": "parent-trace";
|
|
872
|
+
none: "none";
|
|
873
|
+
}>>;
|
|
874
|
+
execution_seq: z.ZodOptional<z.ZodNumber>;
|
|
875
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, SerializableJsonValue, z.core.$ZodTypeInternals<SerializableJsonValue, SerializableJsonValue>>>>;
|
|
876
|
+
type: z.ZodLiteral<"user_input">;
|
|
877
|
+
content: z.ZodString;
|
|
878
|
+
delivery: z.ZodLiteral<"mid_run">;
|
|
879
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
830
880
|
id: z.ZodString;
|
|
831
881
|
timestamp: z.ZodNumber;
|
|
832
882
|
conversation_id: z.ZodString;
|
|
@@ -1573,6 +1623,20 @@ type SSEEvent = z.infer<typeof SSEEvent>;
|
|
|
1573
1623
|
/** Renderer/transport admission 前的 wire 输入;strict parse 后才可作为 SSEEvent 使用。 */
|
|
1574
1624
|
type SSEEventInput = z.input<typeof SSEEvent>;
|
|
1575
1625
|
declare const validateSSEEvent: (event: unknown) => z.ZodSafeParseResult<{
|
|
1626
|
+
id: string;
|
|
1627
|
+
timestamp: number;
|
|
1628
|
+
conversation_id: string;
|
|
1629
|
+
turn_id: string;
|
|
1630
|
+
type: "user_input";
|
|
1631
|
+
content: string;
|
|
1632
|
+
delivery: "mid_run";
|
|
1633
|
+
run_id?: (string & z.core.$brand<"RunId">) | undefined;
|
|
1634
|
+
execution_id?: string | undefined;
|
|
1635
|
+
lane?: "foreground" | "auxiliary" | "child" | undefined;
|
|
1636
|
+
visibility?: "conversation" | "parent-trace" | "none" | undefined;
|
|
1637
|
+
execution_seq?: number | undefined;
|
|
1638
|
+
metadata?: Record<string, SerializableJsonValue> | undefined;
|
|
1639
|
+
} | {
|
|
1576
1640
|
id: string;
|
|
1577
1641
|
timestamp: number;
|
|
1578
1642
|
conversation_id: string;
|
|
@@ -2057,5 +2121,5 @@ declare const createSSERunStatusEvent: (id: string, conversationId: string, turn
|
|
|
2057
2121
|
declare const createSSETransportEndEvent: (id: string, conversationId: string, turnId: string, options: SSEEventCreatorOptions<SSETransportEndEvent> & Pick<SSETransportEndEvent, "execution_id">) => SSETransportEndEvent;
|
|
2058
2122
|
declare const createSSEHistorySummaryEvent: (id: string, conversationId: string, turnId: string, content: string, replacedMessageIds: readonly string[], originalMessageCount: number, summarySeq: number, options?: SSEEventCreatorOptions<SSEHistorySummaryEvent, "summary_id" | "content" | "replaced_message_ids" | "original_message_count" | "summary_seq">) => SSEHistorySummaryEvent;
|
|
2059
2123
|
|
|
2060
|
-
export { BaseSSEEvent, SSEContextUsageSnapshotEvent, SSEErrorEvent, SSEEvent, SSEExecutionScope, SSEFinalAnswerChunkEvent, SSEFinalAnswerEvent, SSEFinalAnswerResetEvent, SSEHistorySummaryEvent, SSELlmRetryEvent, SSEMarkdownChunkEvent, SSERequiresUserInteractionEvent, SSERunExecutionMetricsEvent, SSERunStatusEvent, SSESubRunTraceEvent, SSESummarizationEndEvent, SSESummarizationErrorEvent, SSESummarizationStartEvent, SSEThoughtEvent, SSEToolCallDecisionEvent, SSEToolOutputEvent, SSEToolProcessEvent, SSETransportEndEvent, SSETransportErrorEvent, createSSEErrorEvent, createSSEFinalAnswerChunkEvent, createSSEFinalAnswerEvent, createSSEHistorySummaryEvent, createSSEMarkdownChunkEvent, createSSERequiresUserInteractionEvent, createSSERunStatusEvent, createSSESubRunTraceEvent, createSSEThoughtEvent, createSSEToolCallDecisionEvent, createSSEToolOutputEvent, createSSEToolProcessEvent, createSSETransportEndEvent, createSSETransportErrorEvent, parseSSEExecutionScope, runtimeEventToSSEEvent, validateSSEEvent };
|
|
2124
|
+
export { BaseSSEEvent, SSEContextUsageSnapshotEvent, SSEErrorEvent, SSEEvent, SSEExecutionScope, SSEFinalAnswerChunkEvent, SSEFinalAnswerEvent, SSEFinalAnswerResetEvent, SSEHistorySummaryEvent, SSELlmRetryEvent, SSEMarkdownChunkEvent, SSERequiresUserInteractionEvent, SSERunExecutionMetricsEvent, SSERunStatusEvent, SSESubRunTraceEvent, SSESummarizationEndEvent, SSESummarizationErrorEvent, SSESummarizationStartEvent, SSEThoughtEvent, SSEToolCallDecisionEvent, SSEToolOutputEvent, SSEToolProcessEvent, SSETransportEndEvent, SSETransportErrorEvent, SSEUserInputEvent, createSSEErrorEvent, createSSEFinalAnswerChunkEvent, createSSEFinalAnswerEvent, createSSEHistorySummaryEvent, createSSEMarkdownChunkEvent, createSSERequiresUserInteractionEvent, createSSERunStatusEvent, createSSESubRunTraceEvent, createSSEThoughtEvent, createSSEToolCallDecisionEvent, createSSEToolOutputEvent, createSSEToolProcessEvent, createSSETransportEndEvent, createSSETransportErrorEvent, parseSSEExecutionScope, runtimeEventToSSEEvent, validateSSEEvent };
|
|
2061
2125
|
export type { SSEEventInput };
|
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;
|