@xiaozhiclaw/qlogicagent-core 0.6.2 → 0.6.3

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.
@@ -89,6 +89,9 @@ export interface CloudAgentOptions extends Omit<CreateEmbeddedAgentOptions, "too
89
89
  onWait?(invocation: CloudToolInvocation, wait: CloudToolWait["wait"]): Promise<void>;
90
90
  /** Await the durable attempt record before network I/O and before acknowledging completion. */
91
91
  onModelOperation?(operation: ModelOperation): Promise<void>;
92
+ /** Load only an original completed response needed for replay. The SaaS owns
93
+ * its immutable archive and scope checks; metadata remains in the checkpoint. */
94
+ loadModelResponse?(context: Readonly<CloudExecutionContext>, operation: Readonly<ModelOperation>): Promise<NonNullable<ModelOperation["response"]>>;
92
95
  /** Product/model service atomically reserves money or token quota before network I/O. */
93
96
  reserveModelBudget?(context: Readonly<CloudExecutionContext>, operation: Omit<ModelOperation, "response">, request: LLMRequest, signal?: AbortSignal): Promise<{
94
97
  reference: string;
@@ -66,6 +66,13 @@ export interface CloudTaskStore {
66
66
  /** CAS + live lease check + snapshot + next contiguous event cursor in one transaction. */
67
67
  update(context: CloudExecutionContext, id: string, expectedRevision: number, task: CloudTaskSnapshot, event: CloudTaskEventPayload, leaseId?: string): Promise<CloudTaskSnapshot>;
68
68
  release(context: CloudExecutionContext, id: string, leaseId: string): Promise<void>;
69
+ /** Text-only CAS event append without resending unchanged task history. */
70
+ appendDelta?(context: CloudExecutionContext, id: string, expectedRevision: number, event: Extract<CloudTurnEvent, {
71
+ type: "delta";
72
+ }>, leaseId: string): Promise<{
73
+ revision: number;
74
+ cursor: number;
75
+ }>;
69
76
  events(context: CloudExecutionContext, id: string, after: number, limit: number): Promise<CloudTaskEvent[]>;
70
77
  /** Atomic lease invalidation. Preserve unresolved model billing/effects as reconciliation_required;
71
78
  * acknowledge cancelled only when their outcomes are known. Terminal tasks stay unchanged. */
@@ -46,6 +46,7 @@ export interface TurnRequest {
46
46
  continuation?: {
47
47
  completedRounds: number;
48
48
  usage: TokenUsage;
49
+ pendingOutputText?: string;
49
50
  };
50
51
  }
51
52
  export interface EmbeddedRuntimeOptions {
@@ -82,6 +83,8 @@ export interface TurnCheckpoint {
82
83
  messages: ChatMessage[];
83
84
  completedRounds: number;
84
85
  usage: TokenUsage;
86
+ /** Committed partial final output, retained across response-capacity continuations. */
87
+ pendingOutputText?: string;
85
88
  }
86
89
  export interface EmbeddedAgent {
87
90
  run(request: TurnRequest, signal?: AbortSignal): AsyncGenerator<TurnEvent>;
@@ -21,17 +21,39 @@ export interface CorePlanIssue {
21
21
  export interface CorePlanSnapshot {
22
22
  steps: CorePlanStep[];
23
23
  issues: CorePlanIssue[];
24
+ notes?: CorePlanNote[];
25
+ }
26
+ export interface CorePlanNote {
27
+ id: string;
28
+ category: "decision" | "constraint" | "blocker";
29
+ value: string;
30
+ evidenceRefs?: string[];
31
+ }
32
+ export interface CorePlanPatch {
33
+ upsertSteps?: CorePlanStep[];
34
+ removeStepIds?: string[];
35
+ upsertIssues?: CorePlanIssue[];
36
+ removeIssueIds?: string[];
37
+ upsertNotes?: CorePlanNote[];
38
+ removeNoteIds?: string[];
24
39
  }
25
40
  export type CorePlanInput = {
26
41
  action: "read";
27
42
  planId: string;
43
+ cursor?: string;
44
+ limit?: number;
45
+ stepIds?: string[];
28
46
  } | ({
29
47
  action: "create";
30
48
  } & CorePlanSnapshot) | ({
31
49
  action: "update";
32
50
  planId: string;
33
51
  expectedRevision: string;
34
- } & CorePlanSnapshot);
52
+ } & CorePlanSnapshot) | ({
53
+ action: "patch";
54
+ planId: string;
55
+ expectedRevision: string;
56
+ } & CorePlanPatch);
35
57
  export interface CoreConfirmationInput {
36
58
  /** Immutable prepared-operation reference issued and resolved by the Host. */
37
59
  operationRef: string;
@@ -91,6 +113,8 @@ export interface CoreToolAdapter {
91
113
  }
92
114
  /** Artifact inventory, independent of any product's currently mounted handlers. */
93
115
  export declare function getCoreToolDefinitions(): ToolDefinition[];
116
+ /** Pure contract validation for a Host's locked snapshot; it owns CAS and persistence. */
117
+ export declare function applyCorePlanPatch(snapshot: CorePlanSnapshot, patch: CorePlanPatch): CorePlanSnapshot;
94
118
  /** A typed dispatch adapter for the existing CloudAgent/CloudTask tool loop.
95
119
  * The Host owns discovery, data, authorization, plans and user-decision receipts.
96
120
  */
@@ -3,7 +3,8 @@ export { prepareSlidingWindowContext } from "./context-projection.js";
3
3
  export { corePackageVersion } from "./package-version.js";
4
4
  export { getCoreCapabilities } from "./core-capabilities.js";
5
5
  export type { CoreCapabilities } from "./core-capabilities.js";
6
- export { createCoreToolAdapter } from "./core-tools.js";
6
+ export { createCoreToolAdapter, applyCorePlanPatch } from "./core-tools.js";
7
+ export type { CorePlanPatch, CorePlanNote } from "./core-tools.js";
7
8
  export type { CoreToolAdapter, CoreToolHost, CoreToolInputs, CoreToolName, CoreToolHandler, CoreToolWait, CoreResourceRead, CorePlanStep, CorePlanIssue, CorePlanSnapshot, CorePlanInput, CoreConfirmationInput } from "./core-tools.js";
8
9
  export { AgentContentBlockValidationError, parseAgentContentBlock, } from "./content-blocks.js";
9
10
  export type { ContextAnchor, ContextEnvelope, SemanticToolCapability, ToolIdentity, UsageRecord, UsageSource, AgentLogger, ChatMessage, CreateEmbeddedAgentOptions, EmbeddedAgent, EmbeddedRuntimeOptions, ModelContextPreparation, ModelContextProjection, LLMChunk, LLMRequest, LLMTransport, ModelRetryAuthorization, ToolDefinition, ToolInvoker, ToolInvocationContext, ToolResult, TurnCheckpoint, TokenUsage, TurnConfig, TurnEvent, TurnRequest, } from "./contracts.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaozhiclaw/qlogicagent-core",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Shared SaaS Agent inference and durable task runtime",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",