@xiaozhiclaw/qlogicagent-core 0.6.6 → 0.6.8
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 +56 -5
- package/dist/automation.js +1 -0
- package/dist/index.js +10 -7
- package/dist/types/contracts/chat.d.ts +5 -1
- package/dist/types/contracts/tool-execution-evidence.d.ts +0 -7
- package/dist/types/contracts/turn-event.d.ts +1 -1
- package/dist/types/embedded/automation.d.ts +27 -0
- package/dist/types/embedded/cloud-task.d.ts +1 -1
- package/dist/types/embedded/context-projection.d.ts +2 -0
- package/dist/types/embedded/contracts.d.ts +11 -0
- package/dist/types/embedded/index.d.ts +4 -0
- package/dist/types/embedded/task-recovery.d.ts +17 -0
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -16,6 +16,24 @@ persistence. Login, permissions, conversations, business commits, audit, files,
|
|
|
16
16
|
database connections and workers remain with the product. Model routing,
|
|
17
17
|
credentials and accounting remain with its model service.
|
|
18
18
|
|
|
19
|
+
Optional `executeWithModelReconnects(runtime, context, id, options)` drives the
|
|
20
|
+
same durable runtime. The default allows five reconnects after the first rejected
|
|
21
|
+
attempt, with exponential backoff anchored to the persisted attempt timestamps.
|
|
22
|
+
The original owner must prove retry safety through `authorizeRecovery`; unknown
|
|
23
|
+
results remain pending reconciliation. Cancellation, authorization, task inputs,
|
|
24
|
+
receipts and budgets retain their existing owners. Plain `runtime.execute` is
|
|
25
|
+
unchanged. An explicit `operatorRetryRequestId` permits only one additional retry
|
|
26
|
+
of that exact original rejection; it never resets the automatic allowance.
|
|
27
|
+
|
|
28
|
+
`AutomationSchedule`, `validAutomationSchedule` and `automationOccurrence` provide
|
|
29
|
+
optional once, interval, daily, weekly, monthly and yearly trigger calculation.
|
|
30
|
+
Pass a fixed `utcOffsetMinutes` explicitly; IANA zones and daylight-saving
|
|
31
|
+
transitions are not resolved by this API. Month ends clamp to the last valid day.
|
|
32
|
+
The result is the latest due occurrence, not a backlog of missed jobs. The host
|
|
33
|
+
chooses catch-up/overlap policy and atomically registers a scope-bound occurrence
|
|
34
|
+
and its original task/input in its own store. Business report periods stay in the
|
|
35
|
+
product. These exports require no configuration package or model-service SDK.
|
|
36
|
+
|
|
19
37
|
```ts
|
|
20
38
|
import { createCloudAgent } from "@xiaozhiclaw/qlogicagent-core";
|
|
21
39
|
|
|
@@ -200,8 +218,18 @@ with a different context projection requires explicit product migration; Core
|
|
|
200
218
|
does not reinterpret its saved input or tool receipts. Checkpoints without an
|
|
201
219
|
assistant context retain their existing binding protocol.
|
|
202
220
|
Optional `goal` requires a product `verifyGoal` callback before semantic completion.
|
|
203
|
-
Products may resolve a user-confirmed goal from receipts with `resolveGoal
|
|
204
|
-
|
|
221
|
+
Products may resolve a user-confirmed goal from receipts with `resolveGoal`.
|
|
222
|
+
Incomplete evidence returns to the same loop by default; `goalFeedback` can
|
|
223
|
+
override its wording or return `[]` to stop. Unchanged incomplete evidence stops
|
|
224
|
+
repeated completion claims. Additional read receipts or worker replacement do not
|
|
225
|
+
prove business progress; this comparison reuses the persisted outcome.
|
|
226
|
+
Two consecutive identical batches rejected before tool dispatch, with no new
|
|
227
|
+
input, end with `TOOL_ARGUMENTS_STALLED`. The check uses checkpoint history;
|
|
228
|
+
changed proposals, mixed valid work and new input keep their normal execution path.
|
|
229
|
+
CloudTask terminal events report `taskOutcome: "satisfied" | "incomplete"` after
|
|
230
|
+
independent verification; an incomplete outcome also has `turnStatus: "stopped"`.
|
|
231
|
+
Without a confirmed goal, `taskOutcome` remains `"unverified"`; lifecycle completion
|
|
232
|
+
does not prove a business result. Product budgets, authorization and waits still apply.
|
|
205
233
|
The model can correct its work or use existing input/confirmation wait tools;
|
|
206
234
|
the product continues to own the acceptance criteria and verification rules.
|
|
207
235
|
Criteria may carry opaque product `parameters`; verification can return `expected`,
|
|
@@ -211,7 +239,7 @@ Context anchors carry explicit revision/supersession/source references through
|
|
|
211
239
|
compaction, keeping unresolved conflicts visible. Product tools retrieve material.
|
|
212
240
|
Optional `runtime.prepareContext(messages, context)` asynchronously retrieves and
|
|
213
241
|
projects product task materials before inference. `context` carries the model,
|
|
214
|
-
input token budget, session/turn IDs and cancellation signal.
|
|
242
|
+
input token budget, resident tool schemas, session/turn IDs and cancellation signal.
|
|
215
243
|
The budget is `Infinity` when context-capacity metadata is explicitly disabled;
|
|
216
244
|
retrieval still runs and the provider remains responsible for its actual capacity.
|
|
217
245
|
Return `{ messages, droppedCount, strategy }`; retrieval and fact updates are applied even
|
|
@@ -224,8 +252,22 @@ fills remaining capacity with recent history. These essential messages may excee
|
|
|
224
252
|
capacity; Core does not silently drop them or pretend an estimate proves model fit.
|
|
225
253
|
Optional `runtime.countMessageTokens(message, model)` supplies model-aware counts
|
|
226
254
|
for the default window. Its fallback is an advisory serialized-message estimate.
|
|
227
|
-
The
|
|
228
|
-
|
|
255
|
+
The default projection reserves configured maximum output tokens and resident
|
|
256
|
+
tool schema cost before selecting message history; provider context errors remain authoritative.
|
|
257
|
+
Optional `runtime.summarizeContext({previousSummary, messages}, context)` summarizes
|
|
258
|
+
only omitted complete protocol groups and merges the prior summary. Configure it
|
|
259
|
+
through the product's existing metered model service. The callback receives a
|
|
260
|
+
summary token allowance and cancellation signal; it owns model authorization,
|
|
261
|
+
cost accounting, deduplication and unknown-outcome recovery for that work. Its
|
|
262
|
+
usage is not automatically included in the main loop's model-operation ledger.
|
|
263
|
+
The default selector reserves a quarter of message capacity for a summary, pins
|
|
264
|
+
original intent, the latest amendment, facts and the latest complete protocol group,
|
|
265
|
+
and passes remaining older groups to the callback. It saves one derived summary in
|
|
266
|
+
the same checkpoint. Empty/oversized summaries or callback failures fail explicitly;
|
|
267
|
+
they do not silently fall back to discarding history. A provider-acknowledged response
|
|
268
|
+
replays its original projection without invoking the summarizer again.
|
|
269
|
+
`prepareContext`, when supplied, owns the whole projection and takes precedence.
|
|
270
|
+
Summaries are data, never instructions, authenticated facts or authorization.
|
|
229
271
|
After retrieving current product facts, call public
|
|
230
272
|
`prepareSlidingWindowContext(messages, context, countMessageTokens?)` to reuse
|
|
231
273
|
the same canonical window implementation. Product retrieval must not accidentally
|
|
@@ -245,6 +287,15 @@ that contract and enforce the original ceiling atomically; it remains responsibl
|
|
|
245
287
|
for supported currencies, precision and settlement. The model transport supplies
|
|
246
288
|
normalized usage totals; source names in usage records stay opaque to Core.
|
|
247
289
|
|
|
290
|
+
Products explicitly mark independent tools with `meta.executionMode: "parallel"`
|
|
291
|
+
and set `config.maxConcurrentTools` to permit overlap. Omitted or `"sequential"`
|
|
292
|
+
execution modes form barriers: all earlier calls settle before that call starts,
|
|
293
|
+
and later calls wait for it. Consecutive parallel-safe calls share the same bounded
|
|
294
|
+
executor. No safety is inferred from tool names, categories or model arguments.
|
|
295
|
+
Results stream as each call finishes; model/checkpoint history retains original
|
|
296
|
+
call order. Cancellation or a wait stops queued calls; already dispatched effects
|
|
297
|
+
still need their original receipts and the existing reconciliation path.
|
|
298
|
+
|
|
248
299
|
Cloud execution does not invent a round limit, per-response tool-call limit,
|
|
249
300
|
retry-count limit, total presentation-block limit, compaction-count stop or default
|
|
250
301
|
tool timeout. Products may supply per-tool `meta.executionTimeoutMs`; task deadlines
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(e){return typeof e=="string"&&/^\d{4}-\d\d-\d\dT\d\d:\d\d$/u.test(e)&&Number(e.slice(0,4))>=2e3&&Number.isFinite(Date.parse(e+":00Z"))&&new Date(e+":00Z").toISOString().slice(0,16)===e}function D(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e,y=(...i)=>Object.keys(t).every(m=>i.includes(m)),r=(i,m,o)=>Number.isInteger(i)&&Number(i)>=m&&Number(i)<=o;return t.frequency==="once"?y("frequency","at")&&s(t.at):t.frequency==="interval"?y("frequency","every","unit","startAt")&&["minutes","hours"].includes(String(t.unit))&&r(t.every,1,t.unit==="minutes"?10080:168)&&s(t.startAt):y("frequency","time","weekday","monthDay","month")&&typeof t.time=="string"&&/^([01]\d|2[0-3]):[0-5]\d$/u.test(t.time)&&(t.frequency==="daily"&&t.weekday===void 0&&t.monthDay===void 0&&t.month===void 0||t.frequency==="weekly"&&r(t.weekday,1,7)&&t.monthDay===void 0&&t.month===void 0||t.frequency==="monthly"&&r(t.monthDay,1,31)&&t.weekday===void 0&&t.month===void 0||t.frequency==="yearly"&&r(t.month,1,12)&&r(t.monthDay,1,31)&&t.weekday===void 0)}function T(e,t,y){if(!D(e)||!Number.isFinite(t.getTime())||!Number.isInteger(y)||Math.abs(y)>840)throw Error("CLOUD_AUTOMATION_SCHEDULE_INVALID");let r=y*6e4;if(e.frequency==="once"||e.frequency==="interval"){let u=Date.parse((e.frequency==="once"?e.at:e.startAt)+":00Z")-r;if(t.getTime()<u)return null;let a=e.frequency==="interval"?e.every*(e.unit==="minutes"?6e4:36e5):0,f=u+(a?Math.floor((t.getTime()-u)/a)*a:0);return{scheduledAt:new Date(f).toISOString(),scheduledDay:new Date(f+r).toISOString().slice(0,10)}}let i=new Date(t.getTime()+r),m=(u,a,f)=>new Date(Date.UTC(u,a,f)),o=m(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()),[g,l]=e.time.split(":").map(Number),d=g*36e5+l*6e4,c=(u,a)=>m(u,a,Math.min(e.monthDay,m(u,a+1,0).getUTCDate())),n=new Date(o);return e.frequency==="yearly"&&(n=c(o.getUTCFullYear(),e.month-1)),e.frequency==="monthly"&&(n=c(o.getUTCFullYear(),o.getUTCMonth())),e.frequency==="weekly"&&n.setUTCDate(n.getUTCDate()-((n.getUTCDay()||7)-e.weekday+7)%7),n.getTime()+d>i.getTime()&&(e.frequency==="yearly"?n=c(o.getUTCFullYear()-1,e.month-1):e.frequency==="monthly"?n=c(o.getUTCFullYear(),o.getUTCMonth()-1):n.setUTCDate(n.getUTCDate()-(e.frequency==="weekly"?7:1))),{scheduledAt:new Date(n.getTime()+d-r).toISOString(),scheduledDay:n.toISOString().slice(0,10)}}export{T as automationOccurrence,D as validAutomationSchedule};
|