@xiaozhiclaw/qlogicagent-core 0.1.5 → 0.2.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.
@@ -0,0 +1,92 @@
1
+ import type { ChatMessage, ToolDefinition } from "./agent-execution-contracts.js";
2
+ import type { WireUsageRecord } from "../../contracts/usage.js";
3
+ import type { ModelOperation, ModelRecoveryProof } from "../../embedded/model-operation.js";
4
+ export interface LLMRequest {
5
+ /** Stable product execution reference; not a provider-side idempotency guarantee. */
6
+ execution?: {
7
+ requestId: string;
8
+ requestDigest: string;
9
+ round: number;
10
+ attempt: number;
11
+ };
12
+ model: string;
13
+ messages: ChatMessage[];
14
+ tools?: ToolDefinition[];
15
+ toolChoice?: "auto" | "none" | "required" | {
16
+ type: "function";
17
+ name: string;
18
+ };
19
+ temperature?: number;
20
+ maxTokens?: number;
21
+ reasoning?: {
22
+ effort: "minimal" | "low" | "medium" | "high" | "xhigh";
23
+ includeEncryptedReasoning?: boolean;
24
+ };
25
+ /** Core-enforced executable function-call budget; not a Chat Completions wire field. */
26
+ maxToolCalls?: number;
27
+ streamRequired?: boolean;
28
+ promptCacheKey?: string;
29
+ promptCacheRetention?: "in_memory" | "24h";
30
+ serviceTier?: "auto" | "default" | "flex" | "priority";
31
+ parallelToolCalls?: boolean;
32
+ textVerbosity?: "low" | "medium" | "high";
33
+ }
34
+ export type LLMChunk = {
35
+ type: "delta";
36
+ text: string;
37
+ } | {
38
+ type: "tool_call_delta";
39
+ index: number;
40
+ id?: string;
41
+ name?: string;
42
+ arguments: string;
43
+ argumentsMode?: "append" | "replace";
44
+ } | {
45
+ type: "reasoning_delta";
46
+ text: string;
47
+ } | {
48
+ type: "reasoning_block_complete";
49
+ thinking: string;
50
+ signature: string;
51
+ } | {
52
+ type: "usage";
53
+ totalPromptTokens?: number;
54
+ promptTokens: number;
55
+ completionTokens: number;
56
+ reasoningTokens?: number;
57
+ cacheReadTokens?: number;
58
+ cacheCreationTokens?: number;
59
+ records?: WireUsageRecord[];
60
+ } | {
61
+ type: "response_id";
62
+ id: string;
63
+ } | {
64
+ type: "annotations";
65
+ annotations: Array<{
66
+ type: string;
67
+ url?: string;
68
+ title?: string;
69
+ [key: string]: unknown;
70
+ }>;
71
+ } | {
72
+ type: "error";
73
+ message: string;
74
+ outcome?: "rejected" | "unknown";
75
+ } | {
76
+ type: "done";
77
+ finishReason: string;
78
+ };
79
+ export interface AccumulatedToolCall {
80
+ id: string;
81
+ name: string;
82
+ arguments: string;
83
+ }
84
+ export interface LLMTransport {
85
+ /** Forward requested provider controls or reject unsupported ones before inference; never silently discard them. */
86
+ stream(request: LLMRequest, apiKey: string, signal?: AbortSignal): AsyncGenerator<LLMChunk>;
87
+ /** Query the original service receipt without starting inference. Missing evidence must reject. */
88
+ reconcileModel?(operation: ModelOperation, apiKey: string, signal?: AbortSignal): Promise<ModelRecoveryProof>;
89
+ }
90
+ export declare function accumulateToolCalls(accumulator: Map<number, AccumulatedToolCall>, chunk: LLMChunk & {
91
+ type: "tool_call_delta";
92
+ }): void;
@@ -0,0 +1,20 @@
1
+ export interface OpenAiToolCall {
2
+ id: string;
3
+ type: "function";
4
+ function: {
5
+ name: string;
6
+ arguments: string;
7
+ };
8
+ }
9
+ export interface ToolResultMessageInput {
10
+ ok: boolean;
11
+ payload?: unknown;
12
+ error?: string;
13
+ toolReferences?: string[];
14
+ imageUrls?: string[];
15
+ contentBlocks?: import("../../contracts/tool-result.js").ToolResult["contentBlocks"];
16
+ structuredContent?: Record<string, unknown>;
17
+ mcpMeta?: Record<string, unknown>;
18
+ mcpIsError?: boolean;
19
+ }
20
+ export declare function buildToolResultMessage(callId: string, result: ToolResultMessageInput): import("../../contracts/chat.js").ChatMessage;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xiaozhiclaw/qlogicagent-core",
3
- "version": "0.1.5",
4
- "description": "Host-neutral qlogicagent tool-loop runtime for server embedding",
3
+ "version": "0.2.0",
4
+ "description": "Shared SaaS Agent inference and durable task runtime",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/types/embedded/index.d.ts",
@@ -15,19 +15,13 @@
15
15
  "dist/",
16
16
  "README.md"
17
17
  ],
18
- "scripts": {
19
- "build": "node scripts/build.mjs",
20
- "prepare": "node scripts/build.mjs"
21
- },
22
18
  "publishConfig": {
23
19
  "access": "public"
24
20
  },
25
21
  "engines": {
26
22
  "node": ">=24.0.0 <25"
27
23
  },
28
- "devDependencies": {
29
- "@types/node": "^22.15.0",
30
- "esbuild": "^0.28.0",
31
- "typescript": "^5.9.3"
24
+ "scripts": {
25
+ "build": "node scripts/build.mjs"
32
26
  }
33
- }
27
+ }