@deliverd/sdk 0.27.0 → 0.28.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/README.md +42 -0
- package/dist/context.d.ts +46 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +123 -0
- package/dist/http.d.ts +2 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +3 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/released.d.ts +1 -1
- package/dist/released.d.ts.map +1 -1
- package/dist/released.js +1425 -0
- package/dist/types.d.ts +314 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/context.ts +161 -0
- package/src/http.ts +4 -1
- package/src/index.ts +8 -0
- package/src/released.ts +1426 -0
- package/src/types.ts +288 -0
package/src/types.ts
CHANGED
|
@@ -1500,10 +1500,38 @@ export interface TaskContext {
|
|
|
1500
1500
|
* `reports.update()` rather than publishing a second on the same thing.
|
|
1501
1501
|
*/
|
|
1502
1502
|
reports: TaskContextReport[];
|
|
1503
|
+
/**
|
|
1504
|
+
* Confirmed knowledge for this task, few and cut short: what its playbook
|
|
1505
|
+
* and step name first, then the most relevant. A person confirmed each one;
|
|
1506
|
+
* propose anything new with `knowledge.propose()`.
|
|
1507
|
+
*/
|
|
1508
|
+
knowledge: TaskContextKnowledge[];
|
|
1509
|
+
/** The playbook this run follows, and this task's step in it; null when none. */
|
|
1510
|
+
playbook: TaskContextPlaybook | null;
|
|
1503
1511
|
/** One paragraph to say back to yourself to re-anchor on the objective. */
|
|
1504
1512
|
reanchor: string;
|
|
1505
1513
|
}
|
|
1506
1514
|
|
|
1515
|
+
/** A confirmed knowledge entry, as a task's context gives it. */
|
|
1516
|
+
export interface TaskContextKnowledge {
|
|
1517
|
+
id: string;
|
|
1518
|
+
kind: KnowledgeKind;
|
|
1519
|
+
title: string;
|
|
1520
|
+
/** Cut at 600 characters; `knowledge.get(id)` has the rest. */
|
|
1521
|
+
body: string;
|
|
1522
|
+
confirmedBy: string | null;
|
|
1523
|
+
url: string;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/** The playbook a task follows, and its step. */
|
|
1527
|
+
export interface TaskContextPlaybook {
|
|
1528
|
+
id: string;
|
|
1529
|
+
title: string;
|
|
1530
|
+
version: number;
|
|
1531
|
+
/** The step this task is, with the call its rule needs before acting; null on the objective itself. */
|
|
1532
|
+
step: { key: string; title: string; rule: PlaybookStepRule; action: string | null; call: string | null } | null;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1507
1535
|
/** A report published for a task, as its context names it. */
|
|
1508
1536
|
export interface TaskContextReport {
|
|
1509
1537
|
id: string;
|
|
@@ -2613,3 +2641,263 @@ export interface ScreenData {
|
|
|
2613
2641
|
/** The approval a person decides, for an `ask` verdict. */
|
|
2614
2642
|
approval: ScreenApprovalRef | null;
|
|
2615
2643
|
}
|
|
2644
|
+
|
|
2645
|
+
// ── Context: knowledge and playbooks ────────────────────────────────────────
|
|
2646
|
+
|
|
2647
|
+
export type KnowledgeKind = "fact" | "convention" | "decision" | "procedure" | "glossary" | "contact" | "known_issue";
|
|
2648
|
+
export type KnowledgeStatus = "proposed" | "confirmed" | "rejected" | "retired" | "superseded";
|
|
2649
|
+
/** `open` is proposed and confirmed together. */
|
|
2650
|
+
export type KnowledgeStatusFilter = KnowledgeStatus | "open" | "all";
|
|
2651
|
+
|
|
2652
|
+
/** Where an entry came from. */
|
|
2653
|
+
export interface KnowledgeSource {
|
|
2654
|
+
kind: "manual" | "finding" | "decision" | "import" | "url" | "agent";
|
|
2655
|
+
id?: string;
|
|
2656
|
+
url?: string;
|
|
2657
|
+
label?: string;
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
/** One entry of the organisation's knowledge. Only `confirmed` is to be relied on. */
|
|
2661
|
+
export interface KnowledgeEntryData {
|
|
2662
|
+
id: string;
|
|
2663
|
+
url: string;
|
|
2664
|
+
kind: KnowledgeKind;
|
|
2665
|
+
kindLabel: string;
|
|
2666
|
+
title: string;
|
|
2667
|
+
body: string;
|
|
2668
|
+
tags: string[];
|
|
2669
|
+
status: KnowledgeStatus;
|
|
2670
|
+
workspaceId: string | null;
|
|
2671
|
+
flowId: string | null;
|
|
2672
|
+
/** The confirmed entry this replaces once it is confirmed. */
|
|
2673
|
+
supersedesId: string | null;
|
|
2674
|
+
supersededById: string | null;
|
|
2675
|
+
source: KnowledgeSource;
|
|
2676
|
+
owner: string | null;
|
|
2677
|
+
reviewDueOn: string | null;
|
|
2678
|
+
reviewOverdue: boolean;
|
|
2679
|
+
lastReviewedAt: string | null;
|
|
2680
|
+
confirmedBy: string | null;
|
|
2681
|
+
confirmedAt: string | null;
|
|
2682
|
+
decisionNote: string | null;
|
|
2683
|
+
retiredAt: string | null;
|
|
2684
|
+
retiredReason: string | null;
|
|
2685
|
+
externalId: string | null;
|
|
2686
|
+
proposedBy: string;
|
|
2687
|
+
createdAt: string;
|
|
2688
|
+
updatedAt: string;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
export interface KnowledgeDetail extends KnowledgeEntryData {
|
|
2692
|
+
/** Earlier versions this replaced and later ones that replaced it, oldest first. */
|
|
2693
|
+
history: { id: string; title: string; status: KnowledgeStatus; confirmedAt: string | null; url: string }[];
|
|
2694
|
+
/** A proposed revision waiting for a person, on a confirmed entry. */
|
|
2695
|
+
pendingRevision: { id: string; title: string; url: string } | null;
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
export interface ProposeKnowledgeInput {
|
|
2699
|
+
kind: KnowledgeKind;
|
|
2700
|
+
/** The fact or rule in one line. */
|
|
2701
|
+
title: string;
|
|
2702
|
+
/** The detail another agent needs to act on it. A secret is refused. */
|
|
2703
|
+
body: string;
|
|
2704
|
+
tags?: string[];
|
|
2705
|
+
/** One workspace only; the whole organisation when omitted. */
|
|
2706
|
+
workspaceId?: string;
|
|
2707
|
+
flowId?: string;
|
|
2708
|
+
/** The confirmed entry this would replace, once a person confirms it. */
|
|
2709
|
+
supersedesId?: string;
|
|
2710
|
+
sourceUrl?: string;
|
|
2711
|
+
sourceLabel?: string;
|
|
2712
|
+
/** Your own reference. An open entry with the same one comes back instead of a second. */
|
|
2713
|
+
externalId?: string;
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
export interface ProposedKnowledge {
|
|
2717
|
+
entry: KnowledgeEntryData;
|
|
2718
|
+
resumed: boolean;
|
|
2719
|
+
/** Personal data seen in what you wrote, said back to you; null when none. */
|
|
2720
|
+
screening: string | null;
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
export interface EditKnowledgeInput {
|
|
2724
|
+
kind?: KnowledgeKind;
|
|
2725
|
+
title?: string;
|
|
2726
|
+
body?: string;
|
|
2727
|
+
tags?: string[];
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
export interface SearchKnowledgeInput {
|
|
2731
|
+
/** Words, ranked by relevance. Omit for the newest. */
|
|
2732
|
+
q?: string;
|
|
2733
|
+
kind?: KnowledgeKind;
|
|
2734
|
+
/** `confirmed` when omitted. */
|
|
2735
|
+
status?: KnowledgeStatusFilter;
|
|
2736
|
+
workspaceId?: string;
|
|
2737
|
+
flowId?: string;
|
|
2738
|
+
limit?: number;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
export interface KnowledgeSearchResult {
|
|
2742
|
+
entries: KnowledgeEntryData[];
|
|
2743
|
+
/** True when the list was cut at the limit. */
|
|
2744
|
+
more: boolean;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
export interface PromoteFindingInput {
|
|
2748
|
+
kind?: KnowledgeKind;
|
|
2749
|
+
title?: string;
|
|
2750
|
+
body?: string;
|
|
2751
|
+
tags?: string[];
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
export interface ImportKnowledgeInput {
|
|
2755
|
+
/** A Deliverd export, or a notes file such as AGENTS.md. Each heading becomes one proposed entry. */
|
|
2756
|
+
markdown: string;
|
|
2757
|
+
workspaceId?: string;
|
|
2758
|
+
/** Where the file came from, e.g. the repository and path. */
|
|
2759
|
+
source?: string;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
export interface ImportedKnowledge {
|
|
2763
|
+
created: KnowledgeEntryData[];
|
|
2764
|
+
skipped: { title: string; reason: string }[];
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
export interface ExportKnowledgeInput {
|
|
2768
|
+
/** `confirmed` when omitted. */
|
|
2769
|
+
status?: KnowledgeStatusFilter;
|
|
2770
|
+
workspaceId?: string;
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
/** A JSON export: portable entries, with their scope named rather than numbered. */
|
|
2774
|
+
export interface KnowledgeExport {
|
|
2775
|
+
format: "deliverd-knowledge";
|
|
2776
|
+
version: 1;
|
|
2777
|
+
organisation: string;
|
|
2778
|
+
exportedAt: string;
|
|
2779
|
+
entries: {
|
|
2780
|
+
id?: string;
|
|
2781
|
+
kind: KnowledgeKind;
|
|
2782
|
+
title: string;
|
|
2783
|
+
body: string;
|
|
2784
|
+
tags: string[];
|
|
2785
|
+
status?: KnowledgeStatus;
|
|
2786
|
+
/** The workspace's name, or Organisation. */
|
|
2787
|
+
scope?: string | null;
|
|
2788
|
+
owner?: string | null;
|
|
2789
|
+
confirmedBy?: string | null;
|
|
2790
|
+
confirmedOn?: string | null;
|
|
2791
|
+
reviewDueOn?: string | null;
|
|
2792
|
+
source: KnowledgeSource;
|
|
2793
|
+
}[];
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
/** What a task and its side tasks were given, newest first. */
|
|
2797
|
+
export interface ContextGiven {
|
|
2798
|
+
at: string;
|
|
2799
|
+
to: string;
|
|
2800
|
+
via: "task_context" | "playbook_start";
|
|
2801
|
+
playbook: { id: string; title: string; version: number } | null;
|
|
2802
|
+
knowledge: { id: string; title: string; status: KnowledgeStatus; confirmedBy: string | null; url: string }[];
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
export type PlaybookStatus = "draft" | "awaiting_approval" | "not_approved" | "in_force" | "superseded" | "retired";
|
|
2806
|
+
/** What applies before a step's action: nothing, `check_gate`, `request_approval` or `request_review`. */
|
|
2807
|
+
export type PlaybookStepRule = "none" | "gate" | "approval" | "review";
|
|
2808
|
+
|
|
2809
|
+
export interface PlaybookStep {
|
|
2810
|
+
key: string;
|
|
2811
|
+
title: string;
|
|
2812
|
+
instruction: string;
|
|
2813
|
+
rule: PlaybookStepRule;
|
|
2814
|
+
/** For a gate step: the action to check, such as `payments.send`. */
|
|
2815
|
+
action?: string | null;
|
|
2816
|
+
knowledgeIds: string[];
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
export interface PlaybookInput {
|
|
2820
|
+
name: string;
|
|
2821
|
+
description: string;
|
|
2822
|
+
required: boolean;
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
export interface PlaybookData {
|
|
2826
|
+
id: string;
|
|
2827
|
+
url: string;
|
|
2828
|
+
/** Every version of one playbook shares it. */
|
|
2829
|
+
familyId: string;
|
|
2830
|
+
version: number;
|
|
2831
|
+
status: PlaybookStatus;
|
|
2832
|
+
title: string;
|
|
2833
|
+
purpose: string;
|
|
2834
|
+
workspaceId: string | null;
|
|
2835
|
+
inputs: PlaybookInput[];
|
|
2836
|
+
steps: PlaybookStep[];
|
|
2837
|
+
knowledgeIds: string[];
|
|
2838
|
+
note: string | null;
|
|
2839
|
+
approval: { id: string; url: string; status: string } | null;
|
|
2840
|
+
publishedAt: string | null;
|
|
2841
|
+
publishedBy: string | null;
|
|
2842
|
+
retiredAt: string | null;
|
|
2843
|
+
createdBy: string;
|
|
2844
|
+
createdAt: string;
|
|
2845
|
+
updatedAt: string;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
/** A playbook's newest version, and which one is in force. */
|
|
2849
|
+
export interface PlaybookSummary extends PlaybookData {
|
|
2850
|
+
inForce: { id: string; version: number; url: string } | null;
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
export interface PlaybookDetail extends PlaybookData {
|
|
2854
|
+
versions: { id: string; version: number; status: PlaybookStatus; url: string }[];
|
|
2855
|
+
inForceId: string | null;
|
|
2856
|
+
knowledge: KnowledgeEntryData[];
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
export interface DraftPlaybookInput {
|
|
2860
|
+
/** The job, as people name it. */
|
|
2861
|
+
title: string;
|
|
2862
|
+
/** The outcome. Becomes the objective of every run. */
|
|
2863
|
+
purpose: string;
|
|
2864
|
+
steps: {
|
|
2865
|
+
key?: string;
|
|
2866
|
+
title: string;
|
|
2867
|
+
instruction: string;
|
|
2868
|
+
rule?: PlaybookStepRule;
|
|
2869
|
+
action?: string;
|
|
2870
|
+
knowledgeIds?: string[];
|
|
2871
|
+
}[];
|
|
2872
|
+
inputs?: { name: string; description?: string; required?: boolean }[];
|
|
2873
|
+
knowledgeIds?: string[];
|
|
2874
|
+
workspaceId?: string;
|
|
2875
|
+
note?: string;
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
export interface StartPlaybookInput {
|
|
2879
|
+
/** A name for this run; the playbook's title when omitted. */
|
|
2880
|
+
title?: string;
|
|
2881
|
+
inputs?: Record<string, string>;
|
|
2882
|
+
workspaceId?: string;
|
|
2883
|
+
flowId?: string;
|
|
2884
|
+
/** An open run you started under it comes back instead of a second. */
|
|
2885
|
+
externalId?: string;
|
|
2886
|
+
sessionUrl?: string;
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
export interface StartedPlaybook {
|
|
2890
|
+
objective: TaskData;
|
|
2891
|
+
resumed: boolean;
|
|
2892
|
+
playbook: { id: string; title: string; version: number };
|
|
2893
|
+
/** One side task per step, in order. Empty when resumed. */
|
|
2894
|
+
steps: { key: string; taskId: string; title: string; rule: PlaybookStepRule }[];
|
|
2895
|
+
/** True when you named an older version and the one in force ran instead. */
|
|
2896
|
+
ranOlderVersion: boolean;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
export interface RequestPlaybookApprovalInput {
|
|
2900
|
+
/** Emails, names or groups; the organisation's administrators when omitted. */
|
|
2901
|
+
approvers?: string[];
|
|
2902
|
+
note?: string;
|
|
2903
|
+
}
|