@deliverd/sdk 0.26.0 → 0.27.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/src/gates.ts CHANGED
@@ -136,6 +136,8 @@ export class Gate {
136
136
  get scope(): GateData["scope"] { return this.data.scope; }
137
137
  /** How long it lasts and how many uses are left. */
138
138
  get authorisation(): GateData["authorisation"] { return this.data.authorisation; }
139
+ /** The signed yes to hand the code that performs the action. Null unless `canExecute`. */
140
+ get decisionToken(): string | null { return this.data.decisionToken ?? null; }
139
141
  /** A person sent it back. Revise and ask again with `supersedesGateId: gate.id`. */
140
142
  get changesRequested(): boolean { return this.data.status === "changes_requested"; }
141
143
 
@@ -175,6 +177,7 @@ export class Gate {
175
177
  changes: this.data.changes ?? [],
176
178
  id: this.data.id,
177
179
  approvalUrl: this.data.approvalUrl,
180
+ decisionToken: this.data.decisionToken ?? null,
178
181
  gate: this,
179
182
  };
180
183
  }
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ import { Flows } from "./flows.js";
8
8
  import { Tasks } from "./tasks.js";
9
9
  import { AiGovernance } from "./governance.js";
10
10
  import { Webhooks } from "./webhooks.js";
11
+ import { DecisionTokens } from "./decision-token.js";
11
12
  import { WebhookEndpoints } from "./webhook-endpoints.js";
12
13
  import { screen, Screened, type ScreenOptions } from "./screen.js";
13
14
  import { developmentFetch, type DevelopmentOptions } from "./dev.js";
@@ -34,6 +35,19 @@ export { Flow, Flows, type FlowPrimitives } from "./flows.js";
34
35
  export { Task, Tasks } from "./tasks.js";
35
36
  export { AiGovernance, AiSystems, Incidents } from "./governance.js";
36
37
  export { WebhookEndpoints } from "./webhook-endpoints.js";
38
+ export {
39
+ canonicalJson,
40
+ DECISION_TOKEN_CONTEXT,
41
+ DECISION_TOKEN_PREFIX,
42
+ decisionInputHash,
43
+ DecisionTokens,
44
+ EVIDENCE_KEY_PATH,
45
+ verifyDecisionToken,
46
+ type DecisionTokenClaims,
47
+ type DecisionTokenExpectation,
48
+ type DecisionTokenFailure,
49
+ type DecisionTokenResult,
50
+ } from "./decision-token.js";
37
51
  export { Screened, type ScreenOptions } from "./screen.js";
38
52
  export {
39
53
  DATA_KINDS,
@@ -172,6 +186,8 @@ export class Deliverd {
172
186
  readonly schedules: Schedules;
173
187
  readonly webhooks: Webhooks;
174
188
  readonly webhookEndpoints: WebhookEndpoints;
189
+ /** Check a gate's signed yes where the action happens, before it happens. */
190
+ readonly decisionTokens: DecisionTokens;
175
191
  readonly http: HttpClient;
176
192
  /** Whether an imaginary approver is deciding these. */
177
193
  readonly development: boolean;
@@ -206,6 +222,7 @@ export class Deliverd {
206
222
  this.schedules = new Schedules(this.http);
207
223
  this.webhooks = new Webhooks();
208
224
  this.webhookEndpoints = new WebhookEndpoints(this.http);
225
+ this.decisionTokens = new DecisionTokens(this.http.baseUrl, options.fetch);
209
226
  }
210
227
 
211
228
  /**
package/src/messages.ts CHANGED
@@ -181,6 +181,10 @@ export const EXPLANATIONS: Record<string, Explanation> = {
181
181
  message: "That permission was withdrawn after it was given.",
182
182
  hint: "Do not act. Read the gate for who revoked it and why, and ask again if the work still needs doing.",
183
183
  },
184
+ agents_stopped: {
185
+ message: "A person has stopped every agent in this organisation.",
186
+ hint: "Do not act, and do not retry. Tell the user; nothing proceeds until somebody resumes the agents.",
187
+ },
184
188
  gate_cancelled: {
185
189
  message: "That request was withdrawn.",
186
190
  hint: "Ask again if the work still needs doing.",