@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.
package/README.md CHANGED
@@ -1,40 +1,70 @@
1
1
  # @xiaozhiclaw/qlogicagent-core
2
2
 
3
- Host-neutral qlogicagent turn and tool-loop runtime for server embedding.
3
+ Shared Agent runtime for SaaS systems. AgentAtlas and AstraCAD host the same
4
+ canonical inference/tool loop in their own existing services.
5
+
6
+ The package exports three factories:
7
+
8
+ - `createCloudAgent`: trusted application/tenant/actor/scope identity, fresh
9
+ authorization, complete structured results, checkpoints and confirmed resume.
10
+ - `createCloudTaskRuntime`: product-owned durable tasks, cursor events, explicit
11
+ input/confirmation/external waits, cancellation and fenced recovery.
12
+ - `createEmbeddedAgent`: existing low-level SaaS embedding contract.
13
+
14
+ The product injects model transport, tool execution, logging, authorization and
15
+ persistence. Login, permissions, conversations, business commits, audit, files,
16
+ database connections and workers remain with the product. Model routing,
17
+ credentials and accounting remain with its model service.
4
18
 
5
19
  ```ts
6
- import {
7
- createEmbeddedAgent,
8
- type LLMTransport,
9
- type ToolInvoker,
10
- } from "@xiaozhiclaw/qlogicagent-core";
11
-
12
- const agent = createEmbeddedAgent({
13
- llmTransport: transport satisfies LLMTransport,
14
- toolInvoker: tools satisfies ToolInvoker,
15
- apiKey: process.env.MODEL_API_KEY,
16
- maxRounds: 6,
20
+ import { createCloudAgent } from "@xiaozhiclaw/qlogicagent-core";
21
+
22
+ const agent = createCloudAgent({
23
+ llmTransport: productModelTransport,
24
+ authorize: (context, action) => product.revalidateAccess(context, action),
25
+ checkpoints: { save: checkpoint => product.saveCheckpoint(checkpoint) },
26
+ onToolResult: (invocation, result) => product.saveToolReceipt(invocation, result),
27
+ toolInvoker: { invoke: (invocation, signal) => product.executeTool(invocation, signal) },
17
28
  });
18
29
 
19
30
  for await (const event of agent.run({
20
- turnId: crypto.randomUUID(),
21
- sessionId: conversationId,
22
- messages,
23
- tools,
24
- config: { model: "model-id", maxToolCalls: 3 },
25
- })) {
26
- // Persist or forward the typed turn events required by the host product.
31
+ turnId, sessionId,
32
+ context: { applicationId, tenantId, actorId, scopeId, definitionVersion },
33
+ messages, tools,
34
+ config: { model, maxRounds: 8, maxToolCalls: 5, maxConcurrentTools: 1 },
35
+ }, signal)) {
36
+ await product.persistAndProjectEvent(event);
27
37
  }
28
38
  ```
29
39
 
30
- The embedding boundary owns model/tool turn behavior plus host-neutral response
31
- content blocks, standard presentation-tool contracts, and engineering-file
32
- evidence extraction. Choice, table, diagram, attachment, and 2D/3D engineering
33
- semantics therefore stay consistent across desktop, SaaS, and future hosts.
34
- Each host remains responsible for rendering those semantics with its own UI.
35
-
36
- The caller retains
37
- authentication, tenant and conversation authority, persistence, knowledge,
38
- business workflows, and deployment. The package does not require the desktop
39
- Host, ACP, MCP, SQLite, Redis, Skills, sub-agents, filesystem tools, or shell
40
- tools.
40
+ Context comes from the authenticated product, never from a model/browser claim.
41
+ Skill knowledge is maintained by each product with its module version; MCP may
42
+ be its tool execution protocol. The core does not install capabilities.
43
+
44
+ Presentation contracts support choices, tables, diagrams, attachments and
45
+ engineering file evidence. Each SaaS renders actual returned content blocks in
46
+ its own UI. Tool names and paths do not imply artifacts or business success.
47
+
48
+ This library has no production dependencies, CLI, desktop host, local tool
49
+ runtime, native session store or per-process credential/policy discovery.
50
+ Unknown tool effects require product reconciliation before recovery.
51
+ Cloud tasks persist inference attempts before network I/O. Unknown model attempts
52
+ require request-bound model-service evidence; acknowledged original responses can
53
+ be replayed without another inference. Sensitive response bodies are excluded from
54
+ progress events. Provider usage is distinct from settlement evidence.
55
+
56
+ Optional `assistantContext` binds module schema/prerequisites, enterprise configuration
57
+ and source state, employee permissions, and versioned platform Skill/examples.
58
+ Optional `goal` requires a product `verifyGoal` callback before semantic completion.
59
+ Task request/deadline budgets survive resume; products own atomic financial quota
60
+ reservation through `reserveModelBudget`. Optional delta batching preserves control
61
+ event order and cursor continuity. These contracts do not create new product stores,
62
+ business rules, queues or accounting authorities.
63
+ Model retries require all three transport-error fields `retryable`, `safeToRetry`
64
+ and `automaticRetryAuthorized` to be explicitly true (`ModelRetryAuthorization`).
65
+ An unknown model outcome pauses a durable task for product reconciliation;
66
+ task names and error text cannot authorize another paid inference request.
67
+
68
+ See the repository's `docs/cloud-runtime.md` for detailed contracts, product
69
+ integration boundaries and acceptance commands. Release status belongs to the
70
+ source workspace README and package registry; this API guide is version-independent.