@felspar/sdk 0.3.0 → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createHostedFelsparClient
3
- } from "./chunk-3YVYBD4H.js";
3
+ } from "./chunk-MIPPJBXB.js";
4
4
 
5
5
  // src/draft-action-gate-outputs.ts
6
6
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -707,7 +707,8 @@ function denialText(verdict) {
707
707
  const why = escalation.why === null ? "" : `: ${escalation.why}`;
708
708
  parts.push(`Escalation ${escalation.id} (${escalation.trigger})${why}`);
709
709
  }
710
- return parts.join(". ");
710
+ parts.push("Don't retry or rephrase this call to get around the gate");
711
+ return `${parts.map((part) => part.endsWith(".") ? part.slice(0, -1) : part).join(". ")}.`;
711
712
  }
712
713
  function gatedRule(rules, toolName) {
713
714
  return Object.hasOwn(rules.tools, toolName) ? rules.tools[toolName] : void 0;
@@ -2,8 +2,8 @@ import {
2
2
  denialText,
3
3
  entityIdOf,
4
4
  jobOf
5
- } from "./chunks/chunk-2RV7RPXW.js";
6
- import "./chunks/chunk-3YVYBD4H.js";
5
+ } from "./chunks/chunk-ZHMUQJT2.js";
6
+ import "./chunks/chunk-MIPPJBXB.js";
7
7
 
8
8
  // src/draft-action-gate-claude.ts
9
9
  function felsparPreToolUse(gate) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  felsparDecisionEvents,
3
3
  felsparGate
4
- } from "./chunks/chunk-7HN5KUTJ.js";
5
- import "./chunks/chunk-2RV7RPXW.js";
6
- import "./chunks/chunk-3YVYBD4H.js";
4
+ } from "./chunks/chunk-FVPYJVF5.js";
5
+ import "./chunks/chunk-ZHMUQJT2.js";
6
+ import "./chunks/chunk-MIPPJBXB.js";
7
7
  export {
8
8
  felsparDecisionEvents,
9
9
  felsparGate
@@ -2,8 +2,8 @@ import {
2
2
  denialText,
3
3
  entityIdOf,
4
4
  jobOf
5
- } from "./chunks/chunk-2RV7RPXW.js";
6
- import "./chunks/chunk-3YVYBD4H.js";
5
+ } from "./chunks/chunk-ZHMUQJT2.js";
6
+ import "./chunks/chunk-MIPPJBXB.js";
7
7
 
8
8
  // src/draft-action-gate-openai.ts
9
9
  function argumentsOf(text) {
@@ -16,8 +16,8 @@ import {
16
16
  outputCheckFromResult,
17
17
  outputTextDigest,
18
18
  sharedDomains
19
- } from "./chunks/chunk-2RV7RPXW.js";
20
- import "./chunks/chunk-3YVYBD4H.js";
19
+ } from "./chunks/chunk-ZHMUQJT2.js";
20
+ import "./chunks/chunk-MIPPJBXB.js";
21
21
  export {
22
22
  checkAction,
23
23
  createActionGate,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FelsparRequestError,
3
3
  createHostedFelsparClient
4
- } from "./chunks/chunk-3YVYBD4H.js";
4
+ } from "./chunks/chunk-MIPPJBXB.js";
5
5
  export {
6
6
  FelsparRequestError,
7
7
  createHostedFelsparClient
package/dist/eve.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  felsparDecisionEvents,
3
3
  felsparGate
4
- } from "./chunks/chunk-7HN5KUTJ.js";
5
- import "./chunks/chunk-2RV7RPXW.js";
6
- import "./chunks/chunk-3YVYBD4H.js";
4
+ } from "./chunks/chunk-FVPYJVF5.js";
5
+ import "./chunks/chunk-ZHMUQJT2.js";
6
+ import "./chunks/chunk-MIPPJBXB.js";
7
7
 
8
8
  // src/eve.ts
9
9
  var felsparMcpUrl = "https://mcp.felspar.ai/mcp";
@@ -147,6 +147,7 @@ declare const refusalSchema: z.ZodPipe<z.ZodObject<{
147
147
  code: string;
148
148
  path: string[];
149
149
  }[] | undefined;
150
+ recovery?: "escalate" | "fix_input" | "retry";
150
151
  fix?: string;
151
152
  escalation?: {
152
153
  id: string;
@@ -191,6 +192,512 @@ export declare function createHostedFelsparClient(configuration: {
191
192
  id: string;
192
193
  }[];
193
194
  }>;
195
+ describeCurrentJob: (job: string) => Promise<{
196
+ schema: "felspar.hosted-job-description.draft/v0";
197
+ job: string;
198
+ trustDomain: string;
199
+ release: {
200
+ releaseId: string;
201
+ releaseDigest: string;
202
+ materialDigest: string;
203
+ expectedAuthorityDigest: string;
204
+ };
205
+ resolutionPolicy: "relative-date-required-types/direct-overrides/v5" | "relational-required-types/direct-overrides/v4" | "scored-required-types/mandatory-gates/v6" | "windowed-required-types/mandatory-gates/v7" | "conditional-required-types/direct-overrides/v3" | "strict-required-types/direct-overrides/v2" | "strict-required-values/direct-overrides/v1";
206
+ questions: {
207
+ definition: {
208
+ key: string;
209
+ contentDigest: string;
210
+ sourceLocator: string;
211
+ allowedValues: string[];
212
+ } | {
213
+ key: string;
214
+ contentDigest: string;
215
+ sourceLocator: string;
216
+ valueRule: {
217
+ type: "boolean";
218
+ };
219
+ } | {
220
+ key: string;
221
+ contentDigest: string;
222
+ sourceLocator: string;
223
+ valueRule: {
224
+ type: "number";
225
+ integer: boolean;
226
+ minimum: number;
227
+ maximum: number;
228
+ };
229
+ unit: string;
230
+ } | {
231
+ key: string;
232
+ contentDigest: string;
233
+ sourceLocator: string;
234
+ valueRule: {
235
+ type: "date";
236
+ };
237
+ };
238
+ evidencePolicy: {
239
+ maxAgeMs: number;
240
+ allowedSourceClasses: string[];
241
+ trustDomain: string;
242
+ };
243
+ key: string;
244
+ type: "number" | "boolean" | "date" | "enum";
245
+ meaning: {
246
+ text: string;
247
+ source: {
248
+ sourceId: string;
249
+ revision: string;
250
+ locator: string;
251
+ contentDigest: string;
252
+ };
253
+ parts: {
254
+ locator: string;
255
+ text: string;
256
+ }[];
257
+ };
258
+ answer: {
259
+ send: "text" | "text_or_value";
260
+ valueFormat: "number" | "calendar-date" | null;
261
+ interpretation: "classified" | "exact_read" | "unsupported";
262
+ threshold: number | null;
263
+ applies: "always" | "conditional";
264
+ dependsOn: string[];
265
+ appliesWhen: string | null;
266
+ reading?: {
267
+ version: "felspar.exact-number/v2";
268
+ unit: {
269
+ kind: "currency";
270
+ code: string;
271
+ } | {
272
+ kind: "percent";
273
+ } | {
274
+ kind: "count";
275
+ words: string[];
276
+ };
277
+ numberStyle: "1,234.56" | "1.234,56" | "1 234,56" | "1'234.56";
278
+ } | {
279
+ version: "felspar.exact-date/v2";
280
+ dateOrder: "unstated" | "month-first" | "day-first";
281
+ } | undefined;
282
+ };
283
+ requiredWhen?: ({
284
+ key: string;
285
+ relativeDate: {
286
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
287
+ anchorKey: string;
288
+ offsetDays: number;
289
+ calendar: {
290
+ kind: "business_days";
291
+ id: string;
292
+ version: string;
293
+ validFrom: string;
294
+ validThrough: string;
295
+ workingWeekdays: number[];
296
+ holidays: string[];
297
+ } | {
298
+ kind: "calendar_days";
299
+ };
300
+ };
301
+ } | {
302
+ key: string;
303
+ relativeToDecision: {
304
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
305
+ offsetDays: number;
306
+ timeZone: string;
307
+ };
308
+ } | {
309
+ key: string;
310
+ equals: string | boolean;
311
+ } | {
312
+ key: string;
313
+ oneOf: string[];
314
+ } | {
315
+ key: string;
316
+ compare: {
317
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
318
+ value: number;
319
+ };
320
+ } | {
321
+ key: string;
322
+ compareFact: {
323
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
324
+ key: string;
325
+ };
326
+ } | {
327
+ key: string;
328
+ compareDate: {
329
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
330
+ value: string;
331
+ };
332
+ })[] | undefined;
333
+ answers?: {
334
+ value: string;
335
+ meaning: string | null;
336
+ inclusions: string[];
337
+ exclusions: string[];
338
+ examples: string[];
339
+ edgeCases: string[];
340
+ }[] | undefined;
341
+ whereToLook?: {
342
+ text: string;
343
+ source: {
344
+ sourceId: string;
345
+ revision: string;
346
+ locator: string;
347
+ contentDigest: string;
348
+ };
349
+ parts: {
350
+ locator: string;
351
+ text: string;
352
+ }[];
353
+ }[] | undefined;
354
+ about?: {
355
+ relationship: string;
356
+ subject: string;
357
+ } | undefined;
358
+ }[];
359
+ rules: {
360
+ id: string;
361
+ sourceLocator: string;
362
+ contentDigest: string;
363
+ when: ({
364
+ key: string;
365
+ relativeDate: {
366
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
367
+ anchorKey: string;
368
+ offsetDays: number;
369
+ calendar: {
370
+ kind: "business_days";
371
+ id: string;
372
+ version: string;
373
+ validFrom: string;
374
+ validThrough: string;
375
+ workingWeekdays: number[];
376
+ holidays: string[];
377
+ } | {
378
+ kind: "calendar_days";
379
+ };
380
+ };
381
+ } | {
382
+ key: string;
383
+ relativeToDecision: {
384
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
385
+ offsetDays: number;
386
+ timeZone: string;
387
+ };
388
+ } | {
389
+ key: string;
390
+ equals: string | boolean;
391
+ } | {
392
+ key: string;
393
+ oneOf: string[];
394
+ } | {
395
+ key: string;
396
+ compare: {
397
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
398
+ value: number;
399
+ };
400
+ } | {
401
+ key: string;
402
+ compareFact: {
403
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
404
+ key: string;
405
+ };
406
+ } | {
407
+ key: string;
408
+ compareDate: {
409
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
410
+ value: string;
411
+ };
412
+ })[];
413
+ outcome: string;
414
+ overrides: string[];
415
+ text: {
416
+ text: string;
417
+ source: {
418
+ sourceId: string;
419
+ revision: string;
420
+ locator: string;
421
+ contentDigest: string;
422
+ };
423
+ parts: {
424
+ locator: string;
425
+ text: string;
426
+ }[];
427
+ };
428
+ scoreRange?: {
429
+ minimumUnits: number;
430
+ maximumUnits: number;
431
+ } | undefined;
432
+ priority?: number | undefined;
433
+ }[];
434
+ outcomes: {
435
+ id: string;
436
+ meaning: {
437
+ text: string;
438
+ source: {
439
+ sourceId: string;
440
+ revision: string;
441
+ locator: string;
442
+ contentDigest: string;
443
+ };
444
+ parts: {
445
+ locator: string;
446
+ text: string;
447
+ }[];
448
+ } | null;
449
+ nextStep?: {
450
+ text: string;
451
+ source: {
452
+ sourceId: string;
453
+ revision: string;
454
+ locator: string;
455
+ contentDigest: string;
456
+ };
457
+ parts: {
458
+ locator: string;
459
+ text: string;
460
+ }[];
461
+ } | null | undefined;
462
+ outputs?: {
463
+ id: string;
464
+ what: {
465
+ text: string;
466
+ locator: string;
467
+ };
468
+ maxCharacters: number;
469
+ checks: {
470
+ check: string;
471
+ rule: string | null;
472
+ must: string;
473
+ }[];
474
+ context?: {
475
+ text: string;
476
+ locator: string;
477
+ id: string;
478
+ }[] | undefined;
479
+ }[] | undefined;
480
+ escalate?: string | undefined;
481
+ }[];
482
+ guidance: {
483
+ gather: string;
484
+ };
485
+ input: {
486
+ jsonSchema: Record<string, unknown>;
487
+ example: {
488
+ mode: "facts";
489
+ executionId: string;
490
+ expectedReleaseDigest: string;
491
+ jobId: string;
492
+ entityId: string;
493
+ facts: Record<string, {
494
+ text: string;
495
+ source: {
496
+ class: string;
497
+ id: string;
498
+ observedAt: string;
499
+ revision?: string | undefined;
500
+ locator?: string | undefined;
501
+ sensitivity?: string | undefined;
502
+ };
503
+ about?: string | undefined;
504
+ } | {
505
+ text: string;
506
+ source: {
507
+ class: string;
508
+ id: string;
509
+ observedAt: string;
510
+ revision?: string | undefined;
511
+ locator?: string | undefined;
512
+ sensitivity?: string | undefined;
513
+ };
514
+ about?: string | undefined;
515
+ }[] | {
516
+ value: string | number | boolean;
517
+ source: {
518
+ class: string;
519
+ id: string;
520
+ observedAt: string;
521
+ revision?: string | undefined;
522
+ locator?: string | undefined;
523
+ sensitivity?: string | undefined;
524
+ excerpt?: string | undefined;
525
+ };
526
+ about?: string | undefined;
527
+ }>;
528
+ related?: Record<string, string | string[]> | undefined;
529
+ identity?: Record<string, string> | undefined;
530
+ } | null;
531
+ exampleNote: string;
532
+ };
533
+ limits: {
534
+ maxEvidenceItems: number;
535
+ maxPassages: number;
536
+ facts: {
537
+ maxExcerptCharacters: 2000;
538
+ maxExcerptsPerQuestion: 3;
539
+ maxFactsBytes: 524288;
540
+ maxQuestions: 64;
541
+ };
542
+ };
543
+ purpose?: {
544
+ text: string;
545
+ source: {
546
+ sourceId: string;
547
+ revision: string;
548
+ locator: string;
549
+ contentDigest: string;
550
+ };
551
+ parts: {
552
+ locator: string;
553
+ text: string;
554
+ }[];
555
+ } | undefined;
556
+ useWhen?: {
557
+ text: string;
558
+ source: {
559
+ sourceId: string;
560
+ revision: string;
561
+ locator: string;
562
+ contentDigest: string;
563
+ };
564
+ parts: {
565
+ locator: string;
566
+ text: string;
567
+ }[];
568
+ }[] | undefined;
569
+ notFor?: {
570
+ text: string;
571
+ source: {
572
+ sourceId: string;
573
+ revision: string;
574
+ locator: string;
575
+ contentDigest: string;
576
+ };
577
+ parts: {
578
+ locator: string;
579
+ text: string;
580
+ }[];
581
+ }[] | undefined;
582
+ owner?: {
583
+ text: string;
584
+ source: {
585
+ sourceId: string;
586
+ revision: string;
587
+ locator: string;
588
+ contentDigest: string;
589
+ };
590
+ parts: {
591
+ locator: string;
592
+ text: string;
593
+ }[];
594
+ } | undefined;
595
+ subject?: {
596
+ type: string;
597
+ definition: {
598
+ text: string;
599
+ source: {
600
+ sourceId: string;
601
+ revision: string;
602
+ locator: string;
603
+ contentDigest: string;
604
+ };
605
+ parts: {
606
+ locator: string;
607
+ text: string;
608
+ }[];
609
+ };
610
+ match: "exact" | "case-insensitive";
611
+ related: {
612
+ identifier: string;
613
+ example: string;
614
+ match: "exact" | "case-insensitive";
615
+ relationship: string;
616
+ meaning: {
617
+ text: string;
618
+ source: {
619
+ sourceId: string;
620
+ revision: string;
621
+ locator: string;
622
+ contentDigest: string;
623
+ };
624
+ parts: {
625
+ locator: string;
626
+ text: string;
627
+ }[];
628
+ };
629
+ cardinality: "one" | "many";
630
+ required: boolean;
631
+ subject: string;
632
+ definition: {
633
+ text: string;
634
+ source: {
635
+ sourceId: string;
636
+ revision: string;
637
+ locator: string;
638
+ contentDigest: string;
639
+ };
640
+ parts: {
641
+ locator: string;
642
+ text: string;
643
+ }[];
644
+ };
645
+ }[];
646
+ send: string;
647
+ identifier?: string | undefined;
648
+ example?: string | undefined;
649
+ } | undefined;
650
+ identity?: {
651
+ mode: "provided" | "fields" | "content" | "issued";
652
+ send: string;
653
+ fields?: {
654
+ identifier: string;
655
+ example: string;
656
+ match: "exact" | "case-insensitive";
657
+ name: string;
658
+ }[] | undefined;
659
+ question?: string | undefined;
660
+ } | undefined;
661
+ escalations?: {
662
+ routes: {
663
+ id: string;
664
+ quote: {
665
+ text: string;
666
+ source: {
667
+ sourceId: string;
668
+ revision: string;
669
+ locator: string;
670
+ contentDigest: string;
671
+ };
672
+ parts: {
673
+ locator: string;
674
+ text: string;
675
+ }[];
676
+ };
677
+ }[];
678
+ unresolved: string | null;
679
+ attemptLimit: string | null;
680
+ rule: string;
681
+ } | undefined;
682
+ whenUnresolved?: {
683
+ text: string;
684
+ source: {
685
+ sourceId: string;
686
+ revision: string;
687
+ locator: string;
688
+ contentDigest: string;
689
+ };
690
+ parts: {
691
+ locator: string;
692
+ text: string;
693
+ }[];
694
+ } | null | undefined;
695
+ attempts?: {
696
+ max: number;
697
+ withProgress: number;
698
+ rule: string;
699
+ } | undefined;
700
+ }>;
194
701
  resolveJob: (id: string, value: unknown) => Promise<FelsparJobResult>;
195
702
  executeJob: (id: string, value: unknown) => Promise<{
196
703
  status: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felspar/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Client and action gate for Felspar, the shared decision system for enterprise agents.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.felspar.ai",
@@ -50,13 +50,8 @@
50
50
  },
51
51
  "./package.json": "./package.json"
52
52
  },
53
- "bin": {
54
- "felspar-sdk": "bin/felspar-sdk.mjs"
55
- },
56
53
  "files": [
57
54
  "dist",
58
- "bin",
59
- "skills/felspar/SKILL.md",
60
55
  "README.md",
61
56
  "LICENSE"
62
57
  ],
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- // The package's command line: `npx @felspar/sdk skill [dir] [--force]`.
3
- import { main } from "./skill.mjs";
4
-
5
- try {
6
- console.log(`Wrote ${main(process.argv.slice(2))}`);
7
- } catch (error) {
8
- console.error(error.message);
9
- process.exitCode = 1;
10
- }
package/bin/skill.mjs DELETED
@@ -1,33 +0,0 @@
1
- // `npx @felspar/sdk skill [dir] [--force]` copies Felspar's agent skill, the
2
- // method for running any Felspar job, to <dir>/skills/felspar/SKILL.md. The
3
- // directory defaults to agent, where an Eve agent keeps its skills.
4
- import { constants, copyFileSync, mkdirSync } from "node:fs";
5
- import path from "node:path";
6
-
7
- export const skillSource = path.join(import.meta.dirname, "../skills/felspar/SKILL.md");
8
- const usage = "usage: npx @felspar/sdk skill [dir] [--force]";
9
-
10
- // Copies the skill and returns where it went. Without force an existing file
11
- // is kept: COPYFILE_EXCL fails on any existing path, a dangling link included.
12
- export function installSkill(directory = "agent", { force = false } = {}) {
13
- const target = path.join(directory, "skills", "felspar", "SKILL.md");
14
- const mode = force ? 0 : constants.COPYFILE_EXCL;
15
- mkdirSync(path.dirname(target), { recursive: true });
16
- try {
17
- copyFileSync(skillSource, target, mode);
18
- } catch (error) {
19
- throw error.code === "EEXIST"
20
- ? new Error(`${target} exists; pass --force to replace it`, { cause: error })
21
- : error;
22
- }
23
- return target;
24
- }
25
-
26
- export function main(argv) {
27
- const force = argv.includes("--force");
28
- const [command, directory, ...rest] = argv.filter((argument) => argument !== "--force");
29
- if (command !== "skill" || rest.length > 0 || directory?.startsWith("-")) {
30
- throw new Error(usage);
31
- }
32
- return installSkill(directory, { force });
33
- }