@xiaozhiclaw/qlogicagent-core 0.1.4 → 0.1.6
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 +48 -24
- package/dist/index.js +9 -9
- package/dist/types/embedded/cloud-agent.d.ts +76 -0
- package/dist/types/embedded/cloud-task.d.ts +76 -0
- package/dist/types/embedded/content-blocks.d.ts +109 -0
- package/dist/types/embedded/contracts.d.ts +56 -7
- package/dist/types/embedded/embedded-agent.d.ts +2 -0
- package/dist/types/embedded/index.d.ts +8 -3
- package/package.json +5 -11
package/README.md
CHANGED
|
@@ -1,34 +1,58 @@
|
|
|
1
1
|
# @xiaozhiclaw/qlogicagent-core
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
21
|
-
|
|
22
|
-
messages,
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
Model retries require all three transport-error fields `retryable`, `safeToRetry`
|
|
52
|
+
and `automaticRetryAuthorized` to be explicitly true (`ModelRetryAuthorization`).
|
|
53
|
+
An unknown model outcome pauses a durable task for product reconciliation;
|
|
54
|
+
task names and error text cannot authorize another paid inference request.
|
|
55
|
+
|
|
56
|
+
See the repository's `docs/cloud-runtime.md` for detailed contracts, product
|
|
57
|
+
integration boundaries and acceptance commands. Release status belongs to the
|
|
58
|
+
source workspace README and package registry; this API guide is version-independent.
|