@xiaozhiclaw/qlogicagent-core 0.4.0 → 0.5.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 +79 -5
- package/dist/index.js +9 -9
- package/dist/types/contracts/turn-event.d.ts +2 -0
- package/dist/types/contracts/usage.d.ts +2 -2
- package/dist/types/embedded/business-contracts.d.ts +6 -39
- package/dist/types/embedded/business-tool-adapter.d.ts +37 -0
- package/dist/types/embedded/cloud-agent.d.ts +7 -0
- package/dist/types/embedded/cloud-task.d.ts +4 -2
- package/dist/types/embedded/content-blocks.d.ts +7 -105
- package/dist/types/embedded/contracts.d.ts +20 -0
- package/dist/types/embedded/default-runtime-ports.d.ts +6 -0
- package/dist/types/embedded/index.d.ts +6 -3
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +4 -1
- package/dist/types/runtime/ports/model-transport-contracts.d.ts +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,9 +41,10 @@ Context comes from the authenticated product, never from a model/browser claim.
|
|
|
41
41
|
Skill knowledge is maintained by each product with its module version; MCP may
|
|
42
42
|
be its tool execution protocol. The core does not install capabilities.
|
|
43
43
|
|
|
44
|
-
Presentation
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
Presentation payloads are product-defined id/type envelopes. Core preserves
|
|
45
|
+
their fields without defining choice/table/diagram/attachment schemas or parsing
|
|
46
|
+
engineering files. Each SaaS validates and renders its own returned blocks.
|
|
47
|
+
Tool names and paths do not imply artifacts or business success.
|
|
47
48
|
|
|
48
49
|
This library has no production dependencies, CLI, desktop host, local tool
|
|
49
50
|
runtime, native session store or per-process credential/policy discovery.
|
|
@@ -57,8 +58,18 @@ require request-bound model-service evidence; acknowledged original responses ca
|
|
|
57
58
|
be replayed without another inference. Sensitive response bodies are excluded from
|
|
58
59
|
progress events. Provider usage is distinct from settlement evidence.
|
|
59
60
|
|
|
60
|
-
Optional `assistantContext`
|
|
61
|
-
|
|
61
|
+
Optional `assistantContext` is a product-defined JSON object. Core requires no
|
|
62
|
+
organization, employee, brand, knowledge base or Skill. Only its optional
|
|
63
|
+
`instructions` string supplies trusted product guidance; all other fields are
|
|
64
|
+
factual context and are preserved without interpreting their domain schema.
|
|
65
|
+
Products validate their own fields, examples and references, and supply tools
|
|
66
|
+
and independent verifiers. `tenantId` is an opaque data namespace and may identify
|
|
67
|
+
a personal workspace rather than an organization; `actorId` may identify a user
|
|
68
|
+
or service. Nothing creates an enterprise or membership model in Core.
|
|
69
|
+
The `opaque-v1` context projection is checkpoint-bound. An earlier checkpoint
|
|
70
|
+
with a different context projection requires explicit product migration; Core
|
|
71
|
+
does not reinterpret its saved input or tool receipts. Checkpoints without an
|
|
72
|
+
assistant context retain their existing binding protocol.
|
|
62
73
|
Optional `goal` requires a product `verifyGoal` callback before semantic completion.
|
|
63
74
|
Products may resolve a user-confirmed goal from receipts with `resolveGoal`, and
|
|
64
75
|
return independent verification evidence to the same loop through `goalFeedback`.
|
|
@@ -69,6 +80,28 @@ Criteria may carry opaque product `parameters`; verification can return `expecte
|
|
|
69
80
|
domain rules or declare unsupported criteria satisfied.
|
|
70
81
|
Context anchors carry explicit revision/supersession/source references through
|
|
71
82
|
compaction, keeping unresolved conflicts visible. Product tools retrieve material.
|
|
83
|
+
Optional `runtime.prepareContext(messages, context)` asynchronously retrieves and
|
|
84
|
+
projects product task materials before inference. `context` carries the model,
|
|
85
|
+
input token budget, session/turn IDs and cancellation signal.
|
|
86
|
+
The budget is `Infinity` when context-capacity metadata is explicitly disabled;
|
|
87
|
+
retrieval still runs and the provider remains responsible for its actual capacity.
|
|
88
|
+
Return `{ messages, droppedCount, strategy }`; retrieval and fact updates are applied even
|
|
89
|
+
when `droppedCount` is zero. Keep original intent, current user amendments and
|
|
90
|
+
complete tool call/result groups. Source retrieval, conflicts and summaries remain
|
|
91
|
+
product-owned. Checkpoints retain the projected conversation; original tool receipts
|
|
92
|
+
remain complete. Without this callback, the sliding window retains original intent,
|
|
93
|
+
the latest amendment, current facts and the latest complete protocol group, then
|
|
94
|
+
fills remaining capacity with recent history. These essential messages may exceed
|
|
95
|
+
capacity; Core does not silently drop them or pretend an estimate proves model fit.
|
|
96
|
+
Optional `runtime.countMessageTokens(message, model)` supplies model-aware counts
|
|
97
|
+
for the default window. Its fallback is an advisory serialized-message estimate.
|
|
98
|
+
The input budget reserves configured maximum output tokens rather than a fixed
|
|
99
|
+
percentage; provider context errors remain authoritative.
|
|
100
|
+
After retrieving current product facts, call public
|
|
101
|
+
`prepareSlidingWindowContext(messages, context, countMessageTokens?)` to reuse
|
|
102
|
+
the same canonical window implementation. Product retrieval must not accidentally
|
|
103
|
+
disable context-capacity handling. The helper preserves objective/fact anchors
|
|
104
|
+
and complete tool protocol groups without changing the supplied messages.
|
|
72
105
|
Tool text is complete by default. The removed `maxToolResultChars` option is
|
|
73
106
|
replaced by optional product-owned `runtime.projectToolResult`; persisted receipts
|
|
74
107
|
retain the original result. No quality score controls execution.
|
|
@@ -76,6 +109,24 @@ Task request/deadline budgets survive resume; products own atomic financial quot
|
|
|
76
109
|
reservation through `reserveModelBudget`. Optional delta batching preserves control
|
|
77
110
|
event order and cursor continuity. These contracts do not create new product stores,
|
|
78
111
|
business rules, queues or accounting authorities.
|
|
112
|
+
The task ceiling carries an opaque product ID, accounting unit and positive exact
|
|
113
|
+
decimal string. Core does not round it or impose CNY, four-digit precision or an
|
|
114
|
+
amount range. The injected financial authority must accept or explicitly reject
|
|
115
|
+
that contract and enforce the original ceiling atomically; it remains responsible
|
|
116
|
+
for supported currencies, precision and settlement. The model transport supplies
|
|
117
|
+
normalized usage totals; source names in usage records stay opaque to Core.
|
|
118
|
+
|
|
119
|
+
Cloud execution does not invent a round limit, per-response tool-call limit,
|
|
120
|
+
retry-count limit, total presentation-block limit, compaction-count stop or default
|
|
121
|
+
tool timeout. Products may supply per-tool `meta.executionTimeoutMs`; task deadlines
|
|
122
|
+
and caller cancellation still propagate to tool execution.
|
|
123
|
+
Omitted round/tool-call limits remain unbounded; explicit `maxToolCalls: 0`
|
|
124
|
+
allows no tool execution, and `maxRounds: 0` means unbounded rounds.
|
|
125
|
+
Products supply their original request, deadline and financial budgets. A retry
|
|
126
|
+
still requires explicit retryability, proven safety and automatic authorization;
|
|
127
|
+
an unknown request is never retried merely because a connection was lost.
|
|
128
|
+
Products retain their own UI schemas and domain validation. Core validates only
|
|
129
|
+
the presentation envelope and keeps all original receipt fields.
|
|
79
130
|
`appendInput(context, taskId, {id, messages, data?})` lets a product append an authenticated
|
|
80
131
|
user amendment to a resolved completed/stopped task. The amendment ID is durable
|
|
81
132
|
and idempotent; a conflicting repeat is rejected. It preserves the original
|
|
@@ -94,3 +145,26 @@ task names and error text cannot authorize another paid inference request.
|
|
|
94
145
|
See the repository's `docs/cloud-runtime.md` for detailed contracts, product
|
|
95
146
|
integration boundaries and acceptance commands. Release status belongs to the
|
|
96
147
|
source workspace README and package registry; this API guide is version-independent.
|
|
148
|
+
|
|
149
|
+
`createBusinessToolAdapter({port, observe})` adapts a product-owned external job to
|
|
150
|
+
the existing cloud tool wait protocol. `port.submit` deduplicates the original
|
|
151
|
+
invocation; `resolve` calls only `port.query`. Missing/unknown results remain
|
|
152
|
+
external waits, never authorize another submission. Optional `port.cancel`
|
|
153
|
+
returns an authoritative observation rather than assuming cancellation succeeded.
|
|
154
|
+
`observe` persists progress, resource references and outcomes before acknowledgement.
|
|
155
|
+
Forward the immutable `invocation.taskBudget` to paid tools. This adapter owns no
|
|
156
|
+
database, scheduler, polling policy or business condition language.
|
|
157
|
+
|
|
158
|
+
Optional `agent.shouldPause(context, checkpoint)` reads product-owned durable pause
|
|
159
|
+
intent after a saved `model_ready` checkpoint. It finishes the current model or
|
|
160
|
+
atomic tool receipt first; it does not cancel an unknown effect. The task becomes
|
|
161
|
+
`stopped` with `CLOUD_TASK_PAUSED`. `runtime.resume(context, taskId)` queues that
|
|
162
|
+
same safe checkpoint without new input, resetting no budget, deadline or receipt.
|
|
163
|
+
Products must atomically reopen their dispatch projection for this exact transition.
|
|
164
|
+
|
|
165
|
+
Original completed-model replay uses the immutable stored messages and digest.
|
|
166
|
+
Current product retrieval is refreshed for subsequent new rounds only. A digest
|
|
167
|
+
mismatch is reconciliation, never permission to pay for a replacement inference.
|
|
168
|
+
An explicit amendment consumes the previous final no-tool response once before
|
|
169
|
+
advancing the round. Reading a saved final response remains possible after the
|
|
170
|
+
original deadline; any new model request or tool effect still observes that deadline.
|