@rollikey/sdk 0.1.1 → 0.1.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/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { type Transport } from '@modelcontextprotocol/client';
2
2
  import { type StdioServerParameters } from '@modelcontextprotocol/client/stdio';
3
- export type ActionType = 'pg.update' | 'pg.delete' | 'stripe.refund' | 'stripe.authorize_hold' | 's3.put' | 's3.delete' | 's3.acl' | 'github.issue_update' | 'github.pr_update' | 'github.branch_delete' | 'slack.post' | 'slack.archive';
3
+ export type ActionType = 'pg.update' | 'pg.delete' | 'stripe.refund' | 'stripe.authorize_hold' | 's3.put' | 's3.delete' | 's3.acl' | 'github.issue_update' | 'github.pr_update' | 'github.branch_delete' | 'slack.post' | 'slack.archive'
4
+ /** Only ever 'blocked': an email refused by a per-run cap. */
5
+ | 'email.send';
4
6
  /** The five core connectors Rollikey wraps. */
5
7
  export declare const CONNECTORS: readonly ['postgres', 'stripe', 's3', 'github', 'slack'];
6
8
  export type Connector = (typeof CONNECTORS)[number];
@@ -48,6 +50,8 @@ export interface HeldEmail {
48
50
  export type OnDrift = 'halt' | 'overwrite';
49
51
  export interface RevertOptions {
50
52
  onDrift?: OnDrift;
53
+ /** Operator only: snapshot ids of acknowledged revert_failed steps to skip so LIFO can continue. */
54
+ skipStepIds?: string[];
51
55
  }
52
56
  export interface RevertReport {
53
57
  status: 'reverted' | 'partial';
@@ -63,13 +67,23 @@ export interface RevertReport {
63
67
  snapshotId: string;
64
68
  actionType: ActionType;
65
69
  target: string;
66
- status: 'reverted' | 'revert_failed';
70
+ status: 'reverted' | 'revert_failed' | 'skipped';
67
71
  compensation?: Record<string, unknown>;
68
72
  error?: string;
69
73
  code?: string;
70
74
  drifted?: unknown[];
71
75
  }[];
72
76
  remaining: number[];
77
+ /** Snapshot ids skipped via skipStepIds (still revert_failed: their side effect was not undone). */
78
+ skipped?: string[];
79
+ /** Side effects that cannot be recalled, e.g. a Slack post already sent via incoming webhook. */
80
+ unrecallable?: {
81
+ seq: number;
82
+ snapshotId: string;
83
+ actionType: ActionType;
84
+ target: string;
85
+ compensation: Record<string, unknown>;
86
+ }[];
73
87
  }
74
88
  export interface RevertSlackReport {
75
89
  cancelled: string[];
@@ -117,6 +131,12 @@ export interface CaptureResult {
117
131
  feeCents: number;
118
132
  }[];
119
133
  skipped: string[];
134
+ /** Per-hold failures; the other holds of the run are still captured. */
135
+ failed: {
136
+ snapshotId: string;
137
+ paymentIntentId?: string;
138
+ error: string;
139
+ }[];
120
140
  totalFeeCents: number;
121
141
  }
122
142
  export interface EmailInput {
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ export class RollikeyClient {
31
31
  this.opts = opts;
32
32
  }
33
33
  static async connect(transport, opts = {}) {
34
- const client = new Client({ name: 'rollikey-sdk', version: '0.1.1' });
34
+ const client = new Client({ name: 'rollikey-sdk', version: '0.1.2' });
35
35
  await client.connect(transport);
36
36
  return new RollikeyClient(client, { throwOnBlocked: opts.throwOnBlocked ?? true });
37
37
  }
@@ -51,9 +51,7 @@ export class RollikeyClient {
51
51
  const { tools } = await this.client.listTools();
52
52
  return tools.map((t) => {
53
53
  const schema = JSON.parse(JSON.stringify(t.inputSchema ?? { type: 'object', properties: {} }));
54
- delete schema.properties?.runId;
55
- if (schema.required)
56
- schema.required = schema.required.filter((r) => r !== 'runId');
54
+ stripRunId(schema);
57
55
  return { name: t.name, description: t.description ?? '', inputSchema: schema };
58
56
  });
59
57
  }
@@ -73,6 +71,31 @@ export class RollikeyClient {
73
71
  return sc;
74
72
  }
75
73
  }
74
+ /**
75
+ * Remove `runId` everywhere it can be declared: top-level properties and every allOf / anyOf /
76
+ * oneOf branch (intersection schemas put it in its own allOf member). A branch left with nothing
77
+ * but runId is dropped, so it can never reject the remaining arguments.
78
+ */
79
+ function stripRunId(schema) {
80
+ if (schema.properties && 'runId' in schema.properties)
81
+ delete schema.properties.runId;
82
+ if (schema.required)
83
+ schema.required = schema.required.filter((r) => r !== 'runId');
84
+ for (const key of ['allOf', 'anyOf', 'oneOf']) {
85
+ const branches = schema[key];
86
+ if (!Array.isArray(branches))
87
+ continue;
88
+ for (const b of branches)
89
+ stripRunId(b);
90
+ const kept = branches.filter((b) => !(b.properties && Object.keys(b.properties).length === 0 && !b.allOf && !b.anyOf && !b.oneOf));
91
+ if (key === 'allOf') {
92
+ if (kept.length === 0)
93
+ delete schema.allOf;
94
+ else
95
+ schema.allOf = kept;
96
+ }
97
+ }
98
+ }
76
99
  /** Anthropic Messages API: `tools: anthropicTools(await sp.tools())`. */
77
100
  export const anthropicTools = (tools) => tools.map((t) => ({ name: t.name, description: t.description, input_schema: t.inputSchema }));
78
101
  /** OpenAI Chat Completions / Responses function tools: `tools: openAITools(await sp.tools())`. */
@@ -169,7 +192,10 @@ export class RollikeyRun {
169
192
  }
170
193
  /** Undo the run (LIFO). Default onDrift 'halt' stops for review on drift; { onDrift: 'overwrite' } restores anyway. */
171
194
  revert(opts = {}) {
172
- return this.call('rollikey_revert', opts.onDrift ? { onDrift: opts.onDrift } : {});
195
+ return this.call('rollikey_revert', {
196
+ ...(opts.onDrift ? { onDrift: opts.onDrift } : {}),
197
+ ...(opts.skipStepIds?.length ? { skipStepIds: opts.skipStepIds } : {}),
198
+ });
173
199
  }
174
200
  inspect() {
175
201
  return this.call('rollikey_get_run', {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollikey/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Typed client for Rollikey: blast-radius gate, airlock and one-call revert for AI agent actions",
5
5
  "license": "MIT",
6
6
  "repository": {