@felspar/sdk 0.1.1 → 0.2.1

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,9 +1,143 @@
1
1
  import { z } from "zod";
2
+ declare const FelsparCaseSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ mode: z.ZodEnum<{
5
+ provided: "provided";
6
+ fields: "fields";
7
+ content: "content";
8
+ issued: "issued";
9
+ }>;
10
+ }, z.core.$strip>;
11
+ declare const FelsparRelatedSchema: z.ZodObject<{
12
+ relationship: z.ZodString;
13
+ subject: z.ZodString;
14
+ id: z.ZodString;
15
+ questions: z.ZodArray<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ declare const FelsparResultSubjectSchema: z.ZodObject<{
18
+ type: z.ZodString;
19
+ id: z.ZodString;
20
+ related: z.ZodArray<z.ZodObject<{
21
+ relationship: z.ZodString;
22
+ subject: z.ZodString;
23
+ id: z.ZodString;
24
+ questions: z.ZodArray<z.ZodString>;
25
+ }, z.core.$strip>>;
26
+ }, z.core.$strip>;
27
+ declare const FelsparEscalationSchema: z.ZodObject<{
28
+ id: z.ZodString;
29
+ trigger: z.ZodEnum<{
30
+ outcome: "outcome";
31
+ unresolved: "unresolved";
32
+ attempt_limit: "attempt_limit";
33
+ }>;
34
+ why: z.ZodObject<{
35
+ text: z.ZodString;
36
+ }, z.core.$loose>;
37
+ }, z.core.$strip>;
38
+ declare const FelsparJobResultSchema: z.ZodObject<{
39
+ status: z.ZodString;
40
+ reason: z.ZodNullable<z.ZodString>;
41
+ result: z.ZodNullable<z.ZodObject<{
42
+ executionId: z.ZodString;
43
+ releaseId: z.ZodString;
44
+ releaseDigest: z.ZodString;
45
+ outcome: z.ZodNullable<z.ZodString>;
46
+ scoring: z.ZodUnknown;
47
+ context: z.ZodUnknown;
48
+ receipt: z.ZodUnknown;
49
+ case: z.ZodOptional<z.ZodObject<{
50
+ id: z.ZodString;
51
+ mode: z.ZodEnum<{
52
+ provided: "provided";
53
+ fields: "fields";
54
+ content: "content";
55
+ issued: "issued";
56
+ }>;
57
+ }, z.core.$strip>>;
58
+ subject: z.ZodOptional<z.ZodObject<{
59
+ type: z.ZodString;
60
+ id: z.ZodString;
61
+ related: z.ZodArray<z.ZodObject<{
62
+ relationship: z.ZodString;
63
+ subject: z.ZodString;
64
+ id: z.ZodString;
65
+ questions: z.ZodArray<z.ZodString>;
66
+ }, z.core.$strip>>;
67
+ }, z.core.$strip>>;
68
+ escalation: z.ZodOptional<z.ZodObject<{
69
+ id: z.ZodString;
70
+ trigger: z.ZodEnum<{
71
+ outcome: "outcome";
72
+ unresolved: "unresolved";
73
+ attempt_limit: "attempt_limit";
74
+ }>;
75
+ why: z.ZodObject<{
76
+ text: z.ZodString;
77
+ }, z.core.$loose>;
78
+ }, z.core.$strip>>;
79
+ missing: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
+ }, z.core.$loose>>;
81
+ }, z.core.$strip>;
82
+ export type FelsparJobResult = z.infer<typeof FelsparJobResultSchema>;
83
+ export type FelsparJobCase = z.infer<typeof FelsparCaseSchema>;
84
+ export type FelsparRelatedRecord = z.infer<typeof FelsparRelatedSchema>;
85
+ export type FelsparResultSubject = z.infer<typeof FelsparResultSubjectSchema>;
86
+ export type FelsparJobEscalation = z.infer<typeof FelsparEscalationSchema>;
87
+ interface QuotedWords {
88
+ text: string;
89
+ }
90
+ export interface FelsparJobSubject {
91
+ type: string;
92
+ definition: QuotedWords;
93
+ identifier?: string | undefined;
94
+ example?: string | undefined;
95
+ match: "exact" | "case-insensitive";
96
+ related: readonly {
97
+ relationship: string;
98
+ meaning: QuotedWords;
99
+ cardinality: "one" | "many";
100
+ required: boolean;
101
+ subject: string;
102
+ definition: QuotedWords;
103
+ identifier: string;
104
+ example: string;
105
+ match: "exact" | "case-insensitive";
106
+ }[];
107
+ send: string;
108
+ }
109
+ export interface FelsparJobIdentity {
110
+ mode: FelsparJobCase["mode"];
111
+ send: string;
112
+ fields?: readonly {
113
+ name: string;
114
+ identifier: string;
115
+ example: string;
116
+ match: string;
117
+ }[];
118
+ question?: string | undefined;
119
+ }
120
+ export interface FelsparFactsRequest {
121
+ jobId: string;
122
+ executionId: string;
123
+ expectedReleaseDigest?: string;
124
+ entityId?: string;
125
+ identity?: Record<string, string>;
126
+ related?: Record<string, string | string[]>;
127
+ facts: Record<string, unknown>;
128
+ }
129
+ declare const FelsparJobListSchema: z.ZodObject<{
130
+ jobs: z.ZodArray<z.ZodObject<{
131
+ id: z.ZodString;
132
+ }, z.core.$strip>>;
133
+ }, z.core.$strip>;
134
+ export type FelsparJobList = z.infer<typeof FelsparJobListSchema>;
2
135
  declare const refusalSchema: z.ZodPipe<z.ZodObject<{
3
136
  error: z.ZodString;
4
137
  path: z.ZodOptional<z.ZodArray<z.ZodString>>;
5
138
  currentReleaseDigest: z.ZodOptional<z.ZodString>;
6
139
  retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
140
+ escalation: z.ZodOptional<z.ZodUnknown>;
7
141
  issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
8
142
  code: z.ZodString;
9
143
  path: z.ZodArray<z.ZodString>;
@@ -14,6 +148,13 @@ declare const refusalSchema: z.ZodPipe<z.ZodObject<{
14
148
  path: string[];
15
149
  }[] | undefined;
16
150
  fix?: string;
151
+ escalation?: {
152
+ id: string;
153
+ trigger: "outcome" | "unresolved" | "attempt_limit";
154
+ why: {
155
+ text: string;
156
+ };
157
+ };
17
158
  error: string;
18
159
  path?: string[] | undefined;
19
160
  currentReleaseDigest?: string | undefined;
@@ -23,6 +164,7 @@ declare const refusalSchema: z.ZodPipe<z.ZodObject<{
23
164
  path?: string[] | undefined;
24
165
  currentReleaseDigest?: string | undefined;
25
166
  retryAfterSeconds?: number | undefined;
167
+ escalation?: unknown;
26
168
  issues?: {
27
169
  code: string;
28
170
  path: string[];
@@ -43,35 +185,14 @@ export declare function createHostedFelsparClient(configuration: {
43
185
  agentKey?: string;
44
186
  fetcher?: typeof fetch;
45
187
  }): {
46
- executeJob: (id: string, value: unknown) => Promise<{
47
- status: string;
48
- reason: string | null;
49
- result: {
50
- [x: string]: unknown;
51
- executionId: string;
52
- releaseId: string;
53
- releaseDigest: string;
54
- outcome: string | null;
55
- scoring: unknown;
56
- context: unknown;
57
- receipt: unknown;
58
- } | null;
59
- }>;
60
- resolveFacts: (id: string, value: Record<string, unknown>) => Promise<{
61
- status: string;
62
- reason: string | null;
63
- result: {
64
- [x: string]: unknown;
65
- executionId: string;
66
- releaseId: string;
67
- releaseDigest: string;
68
- outcome: string | null;
69
- scoring: unknown;
70
- context: unknown;
71
- receipt: unknown;
72
- } | null;
188
+ resolveFacts: (id: string, value: FelsparFactsRequest | Record<string, unknown>) => Promise<FelsparJobResult>;
189
+ listJobs: () => Promise<{
190
+ jobs: {
191
+ id: string;
192
+ }[];
73
193
  }>;
74
- resolveJob: (id: string, value: unknown) => Promise<{
194
+ resolveJob: (id: string, value: unknown) => Promise<FelsparJobResult>;
195
+ executeJob: (id: string, value: unknown) => Promise<{
75
196
  status: string;
76
197
  reason: string | null;
77
198
  result: {
@@ -1539,7 +1660,7 @@ export declare function createHostedFelsparClient(configuration: {
1539
1660
  outputSurface: string;
1540
1661
  entries: {
1541
1662
  id: string;
1542
- primitive: "gaps" | "actors" | "decision_criteria" | "source_signals" | "needs_and_requirements" | "evidence_and_proof" | "boundaries" | "output_contracts" | "routing_jobs" | "evaluations";
1663
+ primitive: "gaps" | "actors" | "decision_criteria" | "source_signals" | "needs_and_requirements" | "evidence_and_proof" | "boundaries" | "output_contracts" | "routing_jobs" | "evaluations" | "subjects";
1543
1664
  body: string;
1544
1665
  source: {
1545
1666
  sourceId: string;
@@ -1588,6 +1709,61 @@ export declare function createHostedFelsparClient(configuration: {
1588
1709
  max: number;
1589
1710
  withProgress: number;
1590
1711
  } | undefined;
1712
+ subjects?: {
1713
+ job: string;
1714
+ types: {
1715
+ id: string;
1716
+ entryId: string;
1717
+ match: "exact" | "case-insensitive";
1718
+ relationships: {
1719
+ name: string;
1720
+ subject: string;
1721
+ cardinality: "one" | "many";
1722
+ required: boolean;
1723
+ entryId: string;
1724
+ }[];
1725
+ identifier?: string | undefined;
1726
+ example?: string | undefined;
1727
+ }[];
1728
+ about: {
1729
+ key: string;
1730
+ relationship: string;
1731
+ }[];
1732
+ } | undefined;
1733
+ escalations?: {
1734
+ routes: {
1735
+ id: string;
1736
+ entryId: string;
1737
+ }[];
1738
+ outcomes: {
1739
+ outcome: string;
1740
+ escalation: string;
1741
+ }[];
1742
+ unresolved: string | null;
1743
+ attemptLimit: string | null;
1744
+ } | undefined;
1745
+ guide?: {
1746
+ purpose: string | null;
1747
+ useWhen: string[];
1748
+ notFor: string[];
1749
+ owner: string | null;
1750
+ } | undefined;
1751
+ caseIdentity?: {
1752
+ mode: "provided";
1753
+ } | {
1754
+ mode: "fields";
1755
+ fields: {
1756
+ name: string;
1757
+ identifier: string;
1758
+ example: string;
1759
+ match: "exact" | "case-insensitive";
1760
+ }[];
1761
+ } | {
1762
+ mode: "content";
1763
+ question: string;
1764
+ } | {
1765
+ mode: "issued";
1766
+ } | undefined;
1591
1767
  };
1592
1768
  expectedPlanDigest: string;
1593
1769
  requestedSurface: string;
@@ -2517,7 +2693,7 @@ export declare function createHostedFelsparClient(configuration: {
2517
2693
  outputSurface: string;
2518
2694
  entries: {
2519
2695
  id: string;
2520
- primitive: "gaps" | "actors" | "decision_criteria" | "source_signals" | "needs_and_requirements" | "evidence_and_proof" | "boundaries" | "output_contracts" | "routing_jobs" | "evaluations";
2696
+ primitive: "gaps" | "actors" | "decision_criteria" | "source_signals" | "needs_and_requirements" | "evidence_and_proof" | "boundaries" | "output_contracts" | "routing_jobs" | "evaluations" | "subjects";
2521
2697
  body: string;
2522
2698
  source: {
2523
2699
  sourceId: string;
@@ -2566,6 +2742,61 @@ export declare function createHostedFelsparClient(configuration: {
2566
2742
  max: number;
2567
2743
  withProgress: number;
2568
2744
  } | undefined;
2745
+ subjects?: {
2746
+ job: string;
2747
+ types: {
2748
+ id: string;
2749
+ entryId: string;
2750
+ match: "exact" | "case-insensitive";
2751
+ relationships: {
2752
+ name: string;
2753
+ subject: string;
2754
+ cardinality: "one" | "many";
2755
+ required: boolean;
2756
+ entryId: string;
2757
+ }[];
2758
+ identifier?: string | undefined;
2759
+ example?: string | undefined;
2760
+ }[];
2761
+ about: {
2762
+ key: string;
2763
+ relationship: string;
2764
+ }[];
2765
+ } | undefined;
2766
+ escalations?: {
2767
+ routes: {
2768
+ id: string;
2769
+ entryId: string;
2770
+ }[];
2771
+ outcomes: {
2772
+ outcome: string;
2773
+ escalation: string;
2774
+ }[];
2775
+ unresolved: string | null;
2776
+ attemptLimit: string | null;
2777
+ } | undefined;
2778
+ guide?: {
2779
+ purpose: string | null;
2780
+ useWhen: string[];
2781
+ notFor: string[];
2782
+ owner: string | null;
2783
+ } | undefined;
2784
+ caseIdentity?: {
2785
+ mode: "provided";
2786
+ } | {
2787
+ mode: "fields";
2788
+ fields: {
2789
+ name: string;
2790
+ identifier: string;
2791
+ example: string;
2792
+ match: "exact" | "case-insensitive";
2793
+ }[];
2794
+ } | {
2795
+ mode: "content";
2796
+ question: string;
2797
+ } | {
2798
+ mode: "issued";
2799
+ } | undefined;
2569
2800
  };
2570
2801
  expectedPlanDigest: string;
2571
2802
  requestedSurface: string;
@@ -3171,6 +3402,10 @@ export declare function createHostedFelsparClient(configuration: {
3171
3402
  text: string;
3172
3403
  }[];
3173
3404
  }[] | undefined;
3405
+ about?: {
3406
+ relationship: string;
3407
+ subject: string;
3408
+ } | undefined;
3174
3409
  }[];
3175
3410
  rules: {
3176
3411
  id: string;
@@ -3293,6 +3528,7 @@ export declare function createHostedFelsparClient(configuration: {
3293
3528
  id: string;
3294
3529
  }[] | undefined;
3295
3530
  }[] | undefined;
3531
+ escalate?: string | undefined;
3296
3532
  }[];
3297
3533
  guidance: {
3298
3534
  gather: string;
@@ -3315,6 +3551,7 @@ export declare function createHostedFelsparClient(configuration: {
3315
3551
  locator?: string | undefined;
3316
3552
  sensitivity?: string | undefined;
3317
3553
  };
3554
+ about?: string | undefined;
3318
3555
  } | {
3319
3556
  text: string;
3320
3557
  source: {
@@ -3325,6 +3562,7 @@ export declare function createHostedFelsparClient(configuration: {
3325
3562
  locator?: string | undefined;
3326
3563
  sensitivity?: string | undefined;
3327
3564
  };
3565
+ about?: string | undefined;
3328
3566
  }[] | {
3329
3567
  value: string | number | boolean;
3330
3568
  source: {
@@ -3336,7 +3574,10 @@ export declare function createHostedFelsparClient(configuration: {
3336
3574
  sensitivity?: string | undefined;
3337
3575
  excerpt?: string | undefined;
3338
3576
  };
3577
+ about?: string | undefined;
3339
3578
  }>;
3579
+ related?: Record<string, string | string[]> | undefined;
3580
+ identity?: Record<string, string> | undefined;
3340
3581
  } | null;
3341
3582
  exampleNote: string;
3342
3583
  };
@@ -3350,6 +3591,145 @@ export declare function createHostedFelsparClient(configuration: {
3350
3591
  maxQuestions: 64;
3351
3592
  };
3352
3593
  };
3594
+ purpose?: {
3595
+ text: string;
3596
+ source: {
3597
+ sourceId: string;
3598
+ revision: string;
3599
+ locator: string;
3600
+ contentDigest: string;
3601
+ };
3602
+ parts: {
3603
+ locator: string;
3604
+ text: string;
3605
+ }[];
3606
+ } | undefined;
3607
+ useWhen?: {
3608
+ text: string;
3609
+ source: {
3610
+ sourceId: string;
3611
+ revision: string;
3612
+ locator: string;
3613
+ contentDigest: string;
3614
+ };
3615
+ parts: {
3616
+ locator: string;
3617
+ text: string;
3618
+ }[];
3619
+ }[] | undefined;
3620
+ notFor?: {
3621
+ text: string;
3622
+ source: {
3623
+ sourceId: string;
3624
+ revision: string;
3625
+ locator: string;
3626
+ contentDigest: string;
3627
+ };
3628
+ parts: {
3629
+ locator: string;
3630
+ text: string;
3631
+ }[];
3632
+ }[] | undefined;
3633
+ owner?: {
3634
+ text: string;
3635
+ source: {
3636
+ sourceId: string;
3637
+ revision: string;
3638
+ locator: string;
3639
+ contentDigest: string;
3640
+ };
3641
+ parts: {
3642
+ locator: string;
3643
+ text: string;
3644
+ }[];
3645
+ } | undefined;
3646
+ subject?: {
3647
+ type: string;
3648
+ definition: {
3649
+ text: string;
3650
+ source: {
3651
+ sourceId: string;
3652
+ revision: string;
3653
+ locator: string;
3654
+ contentDigest: string;
3655
+ };
3656
+ parts: {
3657
+ locator: string;
3658
+ text: string;
3659
+ }[];
3660
+ };
3661
+ match: "exact" | "case-insensitive";
3662
+ related: {
3663
+ identifier: string;
3664
+ example: string;
3665
+ match: "exact" | "case-insensitive";
3666
+ relationship: string;
3667
+ meaning: {
3668
+ text: string;
3669
+ source: {
3670
+ sourceId: string;
3671
+ revision: string;
3672
+ locator: string;
3673
+ contentDigest: string;
3674
+ };
3675
+ parts: {
3676
+ locator: string;
3677
+ text: string;
3678
+ }[];
3679
+ };
3680
+ cardinality: "one" | "many";
3681
+ required: boolean;
3682
+ subject: string;
3683
+ definition: {
3684
+ text: string;
3685
+ source: {
3686
+ sourceId: string;
3687
+ revision: string;
3688
+ locator: string;
3689
+ contentDigest: string;
3690
+ };
3691
+ parts: {
3692
+ locator: string;
3693
+ text: string;
3694
+ }[];
3695
+ };
3696
+ }[];
3697
+ send: string;
3698
+ identifier?: string | undefined;
3699
+ example?: string | undefined;
3700
+ } | undefined;
3701
+ identity?: {
3702
+ mode: "provided" | "fields" | "content" | "issued";
3703
+ send: string;
3704
+ fields?: {
3705
+ identifier: string;
3706
+ example: string;
3707
+ match: "exact" | "case-insensitive";
3708
+ name: string;
3709
+ }[] | undefined;
3710
+ question?: string | undefined;
3711
+ } | undefined;
3712
+ escalations?: {
3713
+ routes: {
3714
+ id: string;
3715
+ quote: {
3716
+ text: string;
3717
+ source: {
3718
+ sourceId: string;
3719
+ revision: string;
3720
+ locator: string;
3721
+ contentDigest: string;
3722
+ };
3723
+ parts: {
3724
+ locator: string;
3725
+ text: string;
3726
+ }[];
3727
+ };
3728
+ }[];
3729
+ unresolved: string | null;
3730
+ attemptLimit: string | null;
3731
+ rule: string;
3732
+ } | undefined;
3353
3733
  whenUnresolved?: {
3354
3734
  text: string;
3355
3735
  source: {
@@ -3378,6 +3758,23 @@ export declare function createHostedFelsparClient(configuration: {
3378
3758
  entityId: string;
3379
3759
  releaseId: string;
3380
3760
  outcome: string | null;
3761
+ case?: {
3762
+ id: string;
3763
+ mode: "provided" | "fields" | "content" | "issued";
3764
+ } | undefined;
3765
+ subject?: {
3766
+ type: string;
3767
+ related: {
3768
+ relationship: string;
3769
+ subject: string;
3770
+ id: string;
3771
+ questions: string[];
3772
+ }[];
3773
+ } | undefined;
3774
+ escalation?: {
3775
+ id: string;
3776
+ trigger: "outcome" | "unresolved" | "attempt_limit";
3777
+ } | undefined;
3381
3778
  } | undefined;
3382
3779
  }>;
3383
3780
  };
@@ -0,0 +1,22 @@
1
+ export { felsparDecisionEvents, felsparGate } from "./draft-action-gate-eve.js";
2
+ export type { EveApprovalStatus } from "./draft-action-gate-eve.js";
3
+ export declare const felsparMcpUrl = "https://mcp.felspar.ai/mcp";
4
+ export interface FelsparConnectionOptions {
5
+ url?: string;
6
+ agentKey?: string;
7
+ description?: string;
8
+ }
9
+ export interface FelsparConnection {
10
+ url: string;
11
+ description: string;
12
+ auth: {
13
+ getToken: () => Promise<{
14
+ token: string;
15
+ }>;
16
+ };
17
+ protocolVersionDiscovery: false;
18
+ tools: {
19
+ allow: readonly string[];
20
+ };
21
+ }
22
+ export declare function felsparConnection(options?: FelsparConnectionOptions): FelsparConnection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felspar/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
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",
@@ -24,6 +24,10 @@
24
24
  ],
25
25
  "type": "module",
26
26
  "exports": {
27
+ "./eve": {
28
+ "types": "./dist/types/eve.d.ts",
29
+ "default": "./dist/eve.js"
30
+ },
27
31
  "./draft/hosted-client": {
28
32
  "types": "./dist/types/draft-hosted-client.d.ts",
29
33
  "default": "./dist/draft-hosted-client.js"
@@ -46,8 +50,13 @@
46
50
  },
47
51
  "./package.json": "./package.json"
48
52
  },
53
+ "bin": {
54
+ "felspar-sdk": "bin/felspar-sdk.mjs"
55
+ },
49
56
  "files": [
50
57
  "dist",
58
+ "bin",
59
+ "skills/felspar/SKILL.md",
51
60
  "README.md",
52
61
  "LICENSE"
53
62
  ],