@xiaozhiclaw/qlogicagent-core 0.6.7 → 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 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
 
@@ -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};