@xiaozhiclaw/qlogicagent-core 0.6.6 → 0.6.8
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 +56 -5
- package/dist/automation.js +1 -0
- package/dist/index.js +10 -7
- package/dist/types/contracts/chat.d.ts +5 -1
- package/dist/types/contracts/tool-execution-evidence.d.ts +0 -7
- package/dist/types/contracts/turn-event.d.ts +1 -1
- package/dist/types/embedded/automation.d.ts +27 -0
- package/dist/types/embedded/cloud-task.d.ts +1 -1
- package/dist/types/embedded/context-projection.d.ts +2 -0
- package/dist/types/embedded/contracts.d.ts +11 -0
- package/dist/types/embedded/index.d.ts +4 -0
- package/dist/types/embedded/task-recovery.d.ts +17 -0
- package/package.json +10 -1
|
@@ -59,7 +59,9 @@ export interface ChatMessage {
|
|
|
59
59
|
itemId?: string;
|
|
60
60
|
contextAnchors?: ContextAnchor[];
|
|
61
61
|
/** Derived projection of product facts, replaceable by the context transform. */
|
|
62
|
-
contextProjection?: "facts";
|
|
62
|
+
contextProjection?: "facts" | "summary";
|
|
63
|
+
/** Derived summary text; never an authenticated fact or instruction. */
|
|
64
|
+
contextSummary?: string;
|
|
63
65
|
/** For assistant messages with tool calls. */
|
|
64
66
|
tool_calls?: ToolCallMessage[];
|
|
65
67
|
/** For tool result messages. */
|
|
@@ -138,5 +140,7 @@ export interface ToolDefinition {
|
|
|
138
140
|
semanticCapability?: SemanticToolCapability;
|
|
139
141
|
/** Tool-specific deadline supplied by the product. */
|
|
140
142
|
executionTimeoutMs?: number;
|
|
143
|
+
/** Only explicitly independent calls may overlap. Omission is a serial barrier. */
|
|
144
|
+
executionMode?: "parallel" | "sequential";
|
|
141
145
|
};
|
|
142
146
|
}
|
|
@@ -16,10 +16,3 @@ export declare function classifyToolFailureKind(result: {
|
|
|
16
16
|
error?: string;
|
|
17
17
|
details?: Record<string, unknown>;
|
|
18
18
|
}): ToolCallExecutionEvidence["failureKind"];
|
|
19
|
-
export declare function summarizeToolExecutionOutcomes(toolCalls: readonly Pick<ToolCallExecutionEvidence, "name" | "status">[], blockedToolCalls: readonly {
|
|
20
|
-
name: string;
|
|
21
|
-
reason: string;
|
|
22
|
-
}[]): {
|
|
23
|
-
failedTools: string[];
|
|
24
|
-
blockedTools: string[];
|
|
25
|
-
};
|
|
@@ -30,7 +30,7 @@ export type TurnEvent = {
|
|
|
30
30
|
/** Product-requested pause at a durable model-ready boundary. */
|
|
31
31
|
stopReason?: "paused";
|
|
32
32
|
/** Task success remains unverified unless a higher-level product workflow proves it. */
|
|
33
|
-
taskOutcome?: "unverified";
|
|
33
|
+
taskOutcome?: "unverified" | "satisfied" | "incomplete";
|
|
34
34
|
usage?: WireTokenUsage;
|
|
35
35
|
model?: string;
|
|
36
36
|
provider?: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Local wall-clock trigger contract; the host supplies its UTC offset explicitly. */
|
|
2
|
+
export type AutomationCalendarSchedule = {
|
|
3
|
+
frequency: "daily" | "weekly" | "monthly" | "yearly";
|
|
4
|
+
time: string;
|
|
5
|
+
weekday?: number;
|
|
6
|
+
monthDay?: number;
|
|
7
|
+
month?: number;
|
|
8
|
+
};
|
|
9
|
+
export type AutomationSchedule = AutomationCalendarSchedule | {
|
|
10
|
+
frequency: "once";
|
|
11
|
+
at: string;
|
|
12
|
+
} | {
|
|
13
|
+
frequency: "interval";
|
|
14
|
+
every: number;
|
|
15
|
+
unit: "minutes" | "hours";
|
|
16
|
+
startAt: string;
|
|
17
|
+
};
|
|
18
|
+
export interface AutomationOccurrence {
|
|
19
|
+
scheduledAt: string;
|
|
20
|
+
scheduledDay: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function validAutomationSchedule(value: unknown): value is AutomationSchedule;
|
|
23
|
+
/** Latest due occurrence, including the preceding calendar occurrence before today's trigger.
|
|
24
|
+
* No timers, persistence, catch-up jobs, business reporting windows or external effects.
|
|
25
|
+
* Hosts atomically deduplicate scheduledAt in their own authenticated occurrence store.
|
|
26
|
+
* Offsets are fixed: a host using daylight-saving rules must resolve the relevant offset. */
|
|
27
|
+
export declare function automationOccurrence(schedule: AutomationSchedule, now: Date, utcOffsetMinutes: number): AutomationOccurrence | null;
|
|
@@ -87,7 +87,7 @@ export interface CloudTaskRuntimeOptions {
|
|
|
87
87
|
verifyGoal?(task: CloudTaskSnapshot): Promise<BusinessGoalEvidence>;
|
|
88
88
|
/** Product-owned confirmed goals may be established through a tool confirmation receipt. */
|
|
89
89
|
resolveGoal?(task: CloudTaskSnapshot): Promise<BusinessGoal | undefined>;
|
|
90
|
-
/**
|
|
90
|
+
/** Override generic evidence feedback, or return [] to stop. Omission uses the same loop's default correction. */
|
|
91
91
|
goalFeedback?(task: CloudTaskSnapshot, outcome: BusinessGoalOutcome): Promise<ChatMessage[]>;
|
|
92
92
|
authorize(context: CloudExecutionContext, action: "create" | "read" | "execute" | "cancel" | "complete_wait" | "recover" | "append_input" | "resume"): Promise<void>;
|
|
93
93
|
/** Validate product-authorized approval/input or query the original external job; never trust browser results. */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { ChatMessage, EmbeddedRuntimeOptions, ModelContextPreparation, ModelContextProjection } from "./contracts.js";
|
|
2
2
|
/** Reuse the canonical fallback after product retrieval; token estimates are advisory. */
|
|
3
3
|
export declare function prepareSlidingWindowContext(messages: readonly ChatMessage[], context: ModelContextPreparation, countMessageTokens?: EmbeddedRuntimeOptions["countMessageTokens"]): ModelContextProjection;
|
|
4
|
+
/** One projection path for Embedded and Cloud, including original-response replay. */
|
|
5
|
+
export declare function prepareRuntimeContext(messages: readonly ChatMessage[], context: ModelContextPreparation, options: EmbeddedRuntimeOptions): Promise<ModelContextProjection>;
|
|
@@ -57,6 +57,15 @@ export interface EmbeddedRuntimeOptions {
|
|
|
57
57
|
prepareContext?: (messages: readonly ChatMessage[], context: ModelContextPreparation) => Promise<ModelContextProjection>;
|
|
58
58
|
/** Model-aware message measurement; the fallback is an advisory estimate. */
|
|
59
59
|
countMessageTokens?: (message: Readonly<ChatMessage>, model: string) => number;
|
|
60
|
+
/** Incrementally summarize omitted history through the product's metered model service.
|
|
61
|
+
* The callback owns authorization, billing and cancellation for any inference it performs.
|
|
62
|
+
* Summaries remain untrusted data in the existing checkpoint, never a second memory store.
|
|
63
|
+
* prepareContext, when supplied, owns the whole projection instead.
|
|
64
|
+
*/
|
|
65
|
+
summarizeContext?: (input: {
|
|
66
|
+
previousSummary?: string;
|
|
67
|
+
messages: readonly ChatMessage[];
|
|
68
|
+
}, context: ModelContextPreparation) => Promise<string>;
|
|
60
69
|
/** Product-owned model projection; receipts retain the full result. Return undefined to keep it. */
|
|
61
70
|
projectToolResult?: (message: Readonly<ChatMessage>) => Promise<string | undefined>;
|
|
62
71
|
/** Evidence or new questions supplied by the product before accepting a model's final answer. */
|
|
@@ -65,6 +74,8 @@ export interface EmbeddedRuntimeOptions {
|
|
|
65
74
|
}
|
|
66
75
|
export interface ModelContextPreparation {
|
|
67
76
|
model: string;
|
|
77
|
+
/** Exact resident schemas; the default projection reserves their input cost. */
|
|
78
|
+
tools?: readonly ToolDefinition[];
|
|
68
79
|
/** Context capacity after reserving configured output; Infinity when capacity metadata is disabled. */
|
|
69
80
|
inputBudgetTokens: number;
|
|
70
81
|
sessionId: string;
|
|
@@ -16,5 +16,9 @@ export type { BusinessToolAdapter, BusinessToolPort, BusinessToolObservation } f
|
|
|
16
16
|
export { createCloudAgent, completeCloudToolCheckpoint, canonicalCloudValue } from "./cloud-agent.js";
|
|
17
17
|
export type { CloudAgent, CloudAgentOptions, CloudCheckpoint, CloudExecutionContext, CloudToolInvocation, CloudToolReceipt, CloudToolWait, CloudTurnEvent, CloudTurnRequest, } from "./cloud-agent.js";
|
|
18
18
|
export { createCloudTaskRuntime } from "./cloud-task.js";
|
|
19
|
+
export { executeWithModelReconnects, rejectedModelRecoveryAvailable, rejectedModelReconnectAvailable } from "./task-recovery.js";
|
|
20
|
+
export type { ModelReconnectOptions } from "./task-recovery.js";
|
|
21
|
+
export { automationOccurrence, validAutomationSchedule } from "./automation.js";
|
|
22
|
+
export type { AutomationSchedule, AutomationCalendarSchedule, AutomationOccurrence } from "./automation.js";
|
|
19
23
|
export type { CloudTaskStore, CloudTaskSnapshot, CloudTaskStatus, CloudTaskClaim, CloudTaskEvent, CloudTaskEventPayload, CloudTaskRuntime, CloudTaskRuntimeOptions, } from "./cloud-task.js";
|
|
20
24
|
export type { AgentContentBlock } from "./content-blocks.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CloudExecutionContext } from "./cloud-agent.js";
|
|
2
|
+
import type { CloudTaskRuntime, CloudTaskSnapshot } from "./cloud-task.js";
|
|
3
|
+
/** Eligibility is not retry authorization. recover() still requires the original owner's proof. */
|
|
4
|
+
export declare function rejectedModelRecoveryAvailable(task: CloudTaskSnapshot): boolean;
|
|
5
|
+
export declare function rejectedModelReconnectAvailable(task: CloudTaskSnapshot, reconnects?: number): boolean;
|
|
6
|
+
export interface ModelReconnectOptions {
|
|
7
|
+
/** Reconnects after the first attempt, counted from durable operations across worker restarts. */
|
|
8
|
+
reconnects?: number;
|
|
9
|
+
initialDelayMs?: number;
|
|
10
|
+
maxDelayMs?: number;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
/** One explicit host-authorized recovery beyond the automatic allowance, bound to the original request. */
|
|
13
|
+
operatorRetryRequestId?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Optional product-worker driver over the canonical runtime. It never starts a scheduler,
|
|
16
|
+
* creates a replacement task or grants authority to replay unknown model/tool effects. */
|
|
17
|
+
export declare function executeWithModelReconnects(runtime: CloudTaskRuntime, context: CloudExecutionContext, id: string, options?: ModelReconnectOptions): Promise<CloudTaskSnapshot>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaozhiclaw/qlogicagent-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Shared SaaS Agent inference and durable task runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/types/embedded/index.d.ts",
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./automation": {
|
|
14
|
+
"types": "./dist/types/embedded/automation.d.ts",
|
|
15
|
+
"default": "./dist/automation.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"typesVersions": {
|
|
19
|
+
"*": {
|
|
20
|
+
"automation": ["dist/types/embedded/automation.d.ts"]
|
|
12
21
|
}
|
|
13
22
|
},
|
|
14
23
|
"files": [
|