@xiaozhiclaw/qlogicagent-core 0.6.0 → 0.6.2

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
@@ -41,6 +41,120 @@ 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
+ `getCoreCapabilities()` reports the installed artifact's package version and
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.
122
+ - `read`: the Host-issued `planId`, including after a worker/process restart.
123
+ - `update`: `planId`, last `expectedRevision`, and the complete replacement
124
+ `steps` and `issues`. Empty `issues` explicitly clears resolved issues.
125
+
126
+ Steps contain `description`, `status` (`pending`, `in_progress`, `completed`,
127
+ `blocked`, `cancelled`), optional `dependsOn` step IDs and `evidenceRefs`.
128
+ Issues contain `description` and optional affected `stepIds`. Core rejects
129
+ duplicate IDs, missing dependency/issue references and cyclic dependencies.
130
+ The Host authenticates plan/task ownership, allocates identity, durably saves
131
+ snapshots and atomically compares revisions. Return its plan ID and revision in
132
+ the `ToolResult` (for example `structuredContent`). On revision conflict return
133
+ an error with the current revision; the Agent reads and reconciles before retrying.
134
+ The Host must deduplicate writes by the original invocation; Core neither owns
135
+ a plan database nor retries unknown effects. A progress status or evidence
136
+ reference proposed by the model does not prove business completion.
137
+
138
+ `qlogic_request_confirmation` accepts `CoreConfirmationInput`: a Host-issued
139
+ immutable `operationRef`, human-readable `summary`, explicit `targets`
140
+ (`resourceId`, optional `version`) and `impacts`. These model fields describe a
141
+ request; they are not authority. The Host must independently resolve the prepared
142
+ operation, validate that the description matches its canonical targets, versions
143
+ and impacts, and display those canonical facts. A changed or unknown operation
144
+ reference must fail rather than create an approval from model claims.
145
+
146
+ The handler returns an existing authenticated `ToolResult` decision or a wait
147
+ of kind `confirmation`. Persist/deduplicate its request and full invocation before
148
+ waiting, then use the same checkpoints and original receipt recovery as above.
149
+ Approval and rejection are Host-owned results; Core preserves them without
150
+ interpreting them or executing the operation. For CloudTask, the Host's
151
+ `authorizeCompletion` validates the authenticated decision before completion.
152
+ For direct CloudAgent use, validate it before calling `completeCloudToolCheckpoint`.
153
+ The eventual business executor must revalidate the decision against the exact
154
+ prepared operation, actor, scope, resource versions, permission and lifetime.
155
+ Expired, revoked, rejected or changed decisions cannot authorize execution.
156
+ The original-call checkpoint binding does not itself establish approval validity.
157
+
44
158
  Presentation payloads are product-defined id/type envelopes. Core preserves
45
159
  their fields without defining choice/table/diagram/attachment schemas or parsing
46
160
  engineering files. Each SaaS validates and renders its own returned blocks.