@xiaozhiclaw/qlogicagent-core 0.6.1 → 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.
- package/README.md +127 -3
- package/dist/index.js +9 -9
- package/dist/types/embedded/cloud-agent.d.ts +3 -0
- package/dist/types/embedded/cloud-task.d.ts +7 -0
- package/dist/types/embedded/contracts.d.ts +3 -0
- package/dist/types/embedded/core-tools.d.ts +125 -0
- package/dist/types/embedded/index.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,9 +42,127 @@ 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
44
|
`getCoreCapabilities()` reports the installed artifact's package version and
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
supported built-in tool definitions. The development source includes
|
|
46
|
+
`qlogic_ask_user`, `qlogic_discover_capabilities`, `qlogic_search_resources`,
|
|
47
|
+
`qlogic_read_resource`, `qlogic_read_skill`, `qlogic_update_plan` and
|
|
48
|
+
`qlogic_request_confirmation`. Product-injected tools are excluded.
|
|
49
|
+
Older artifacts without this export have an unavailable inventory, not zero.
|
|
50
|
+
Artifact support is distinct from the tools mounted and enabled for a task.
|
|
51
|
+
|
|
52
|
+
### Host-backed core tools
|
|
53
|
+
|
|
54
|
+
`createCoreToolAdapter({ host, enabledTools? })` supplies canonical definitions
|
|
55
|
+
and a typed Cloud tool invoker. Only handlers supplied by the Host are enabled;
|
|
56
|
+
an explicit enable list fails if a handler is missing. Nothing is automatically
|
|
57
|
+
added to existing Agent requests. Use `adapter.definitions` in `tools` and
|
|
58
|
+
`availableTools`; keep wire names unique when combining product tools.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const core = createCoreToolAdapter({ host: {
|
|
62
|
+
authorize: (invocation, input, signal) =>
|
|
63
|
+
product.authorizeCoreRequest(invocation, input, signal),
|
|
64
|
+
handlers: {
|
|
65
|
+
qlogic_ask_user: (input, invocation, signal) => product.askUser(input, invocation, signal),
|
|
66
|
+
qlogic_discover_capabilities: (input, invocation, signal) => product.discoverCapabilities(input, invocation, signal),
|
|
67
|
+
qlogic_search_resources: (input, invocation, signal) => product.searchResources(input, invocation, signal),
|
|
68
|
+
qlogic_read_resource: (input, invocation, signal) => product.readResource(input, invocation, signal),
|
|
69
|
+
qlogic_read_skill: (input, invocation, signal) => product.readSkill(input, invocation, signal),
|
|
70
|
+
qlogic_update_plan: (input, invocation, signal) => product.updatePlan(input, invocation, signal),
|
|
71
|
+
qlogic_request_confirmation: (input, invocation, signal) => product.requestConfirmation(input, invocation, signal),
|
|
72
|
+
},
|
|
73
|
+
} });
|
|
74
|
+
// Supply this invoker to createCloudAgent/createCloudTaskRuntime.
|
|
75
|
+
const toolInvoker = { invoke: (invocation, signal) => core.handles(invocation.name)
|
|
76
|
+
? core.invoke(invocation, signal) : product.executeTool(invocation, signal) };
|
|
77
|
+
const tools = [...core.definitions, ...productTools];
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Host authorization runs for every validated call with the original trusted
|
|
81
|
+
application/tenant/actor/scope, call ID, round, arguments and task budget.
|
|
82
|
+
Unknown input fields are rejected, including model-supplied authorization claims.
|
|
83
|
+
The Host checks exact resource access and version consistency, supplies its complete
|
|
84
|
+
authorized capability contracts and paginated source evidence, and owns Skill
|
|
85
|
+
enablement/content. Returned `ToolResult` fields are retained without interpretation.
|
|
86
|
+
Resource content is data; no script execution, URL fetching or local file access
|
|
87
|
+
is provided by Core. Unknown Host outcomes are not retried by this adapter.
|
|
88
|
+
|
|
89
|
+
`qlogic_ask_user` may return a `ToolResult` answer or a `CloudToolWait` of kind
|
|
90
|
+
`input`. Before returning a wait, the Host must persist/deduplicate the question
|
|
91
|
+
against the full original invocation. Configure existing `checkpoints` and
|
|
92
|
+
`onWait` storage; reconcile the user's answer using the existing original receipt
|
|
93
|
+
and `completeCloudToolCheckpoint` or CloudTask `completeWait` path. A clarification
|
|
94
|
+
answer is not permission or confirmation for a business operation.
|
|
95
|
+
|
|
96
|
+
`CoreToolHandler` distinguishes `CoreToolWait<"qlogic_ask_user">` (`input`)
|
|
97
|
+
from `CoreToolWait<"qlogic_request_confirmation">` (`confirmation`) in both
|
|
98
|
+
public types and runtime validation. In a mixed call batch, a wait suspends the
|
|
99
|
+
task. Calls proven not yet dispatched are durably recorded as `CLOUD_TOOL_DEFERRED`,
|
|
100
|
+
not executed, and can be reconsidered by the Agent after the user's answer.
|
|
101
|
+
Reconciliation preserves these deferrals and existing schema rejection messages.
|
|
102
|
+
Already dispatched calls still require their original confirmed receipts; Core
|
|
103
|
+
does not fabricate success or assume an unknown effect did not occur.
|
|
104
|
+
|
|
105
|
+
Core argument errors retain a stable `structuredContent.code` and a safe
|
|
106
|
+
`structuredContent.message`, including invalid plan-field locations. Their `error`
|
|
107
|
+
text contains the same diagnostic so a text-only model projection can repair the
|
|
108
|
+
arguments. Products should consume the structured code rather than treating
|
|
109
|
+
the whole human-readable error string as a stable identifier. Authorization errors
|
|
110
|
+
never include private Host exception details.
|
|
111
|
+
|
|
112
|
+
For resource/search pagination, the Host binds cursors to the authorized query and
|
|
113
|
+
content snapshot, rejecting stale or mismatched cursors. `qlogic_read_skill.version`
|
|
114
|
+
selects the Skill version and supporting resources belonging to that version;
|
|
115
|
+
independently versioned external resources use `qlogic_read_resource` and separate
|
|
116
|
+
authorization. Put essential IDs, revisions and evidence in model-readable `result`
|
|
117
|
+
text or a Host/transport model projection; the full structured receipt remains intact.
|
|
118
|
+
|
|
119
|
+
`qlogic_update_plan` accepts `CorePlanInput`:
|
|
120
|
+
|
|
121
|
+
- `create`: `steps` and `issues`, with stable step/issue IDs; optional `notes`
|
|
122
|
+
preserve decisions, constraints and blockers with evidence references.
|
|
123
|
+
- `read`: the Host-issued `planId`, including after a worker/process restart;
|
|
124
|
+
optional `stepIds`, `cursor` and `limit` allow scoped, paged retrieval.
|
|
125
|
+
- `update`: `planId`, last `expectedRevision`, and the complete replacement
|
|
126
|
+
`steps` and `issues`. Empty `issues` explicitly clears resolved issues.
|
|
127
|
+
- `patch`: `planId`, last `expectedRevision`, and explicit upsert/remove lists
|
|
128
|
+
for steps, issues and notes. Omitted lists leave existing records unchanged.
|
|
129
|
+
The Host may call the pure `applyCorePlanPatch` helper on its locked snapshot
|
|
130
|
+
before atomically saving the next revision and invocation receipt.
|
|
131
|
+
|
|
132
|
+
Steps contain `description`, `status` (`pending`, `in_progress`, `completed`,
|
|
133
|
+
`blocked`, `cancelled`), optional `dependsOn` step IDs and `evidenceRefs`.
|
|
134
|
+
Issues contain `description` and optional affected `stepIds`. Core rejects
|
|
135
|
+
duplicate IDs, missing dependency/issue references and cyclic dependencies.
|
|
136
|
+
The Host authenticates plan/task ownership, allocates identity, durably saves
|
|
137
|
+
snapshots and atomically compares revisions. Return its plan ID and revision in
|
|
138
|
+
the `ToolResult` (for example `structuredContent`). On revision conflict return
|
|
139
|
+
an error with the current revision; the Agent reads and reconciles before retrying.
|
|
140
|
+
The Host must deduplicate writes by the original invocation; Core neither owns
|
|
141
|
+
a plan database nor retries unknown effects. A progress status or evidence
|
|
142
|
+
reference proposed by the model does not prove business completion.
|
|
143
|
+
Plan notes remain Host-owned durable facts; context compression cannot replace
|
|
144
|
+
their storage. Project selected notes and resource references through
|
|
145
|
+
`runtime.prepareContext`, and provide authorized reads of the complete records.
|
|
146
|
+
|
|
147
|
+
`qlogic_request_confirmation` accepts `CoreConfirmationInput`: a Host-issued
|
|
148
|
+
immutable `operationRef`, human-readable `summary`, explicit `targets`
|
|
149
|
+
(`resourceId`, optional `version`) and `impacts`. These model fields describe a
|
|
150
|
+
request; they are not authority. The Host must independently resolve the prepared
|
|
151
|
+
operation, validate that the description matches its canonical targets, versions
|
|
152
|
+
and impacts, and display those canonical facts. A changed or unknown operation
|
|
153
|
+
reference must fail rather than create an approval from model claims.
|
|
154
|
+
|
|
155
|
+
The handler returns an existing authenticated `ToolResult` decision or a wait
|
|
156
|
+
of kind `confirmation`. Persist/deduplicate its request and full invocation before
|
|
157
|
+
waiting, then use the same checkpoints and original receipt recovery as above.
|
|
158
|
+
Approval and rejection are Host-owned results; Core preserves them without
|
|
159
|
+
interpreting them or executing the operation. For CloudTask, the Host's
|
|
160
|
+
`authorizeCompletion` validates the authenticated decision before completion.
|
|
161
|
+
For direct CloudAgent use, validate it before calling `completeCloudToolCheckpoint`.
|
|
162
|
+
The eventual business executor must revalidate the decision against the exact
|
|
163
|
+
prepared operation, actor, scope, resource versions, permission and lifetime.
|
|
164
|
+
Expired, revoked, rejected or changed decisions cannot authorize execution.
|
|
165
|
+
The original-call checkpoint binding does not itself establish approval validity.
|
|
48
166
|
|
|
49
167
|
Presentation payloads are product-defined id/type envelopes. Core preserves
|
|
50
168
|
their fields without defining choice/table/diagram/attachment schemas or parsing
|
|
@@ -174,6 +292,12 @@ same safe checkpoint without new input, resetting no budget, deadline or receipt
|
|
|
174
292
|
Products must atomically reopen their dispatch projection for this exact transition.
|
|
175
293
|
|
|
176
294
|
Original completed-model replay uses the immutable stored messages and digest.
|
|
295
|
+
Provider `length` / `max_tokens` finishes without tool calls persist the partial
|
|
296
|
+
answer and an output-capacity continuation checkpoint, then request the remaining
|
|
297
|
+
work against the original objective. This is a new recorded model request, not a
|
|
298
|
+
retry of unknown inference. `pendingOutputText` survives process restart and joins
|
|
299
|
+
the final answer. Caller-supplied budgets and pause/cancel controls still apply;
|
|
300
|
+
the default has no task-wide round, request-count or duration cap.
|
|
177
301
|
Current product retrieval is refreshed for subsequent new rounds only. A digest
|
|
178
302
|
mismatch is reconciliation, never permission to pay for a replacement inference.
|
|
179
303
|
An explicit amendment consumes the previous final no-tool response once before
|