@themoltnet/pi-extension 0.22.3 → 0.22.5
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 +112 -117
- package/dist/index.js +8040 -1508
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -8,24 +8,11 @@ import { LoadSkillsResult } from '@earendil-works/pi-coding-agent';
|
|
|
8
8
|
import { Model } from '@earendil-works/pi-ai';
|
|
9
9
|
import { ReadOperations } from '@earendil-works/pi-coding-agent';
|
|
10
10
|
import { Skill } from '@earendil-works/pi-coding-agent';
|
|
11
|
-
import { Static } from '
|
|
12
|
-
import {
|
|
13
|
-
import { TBoolean } from '@sinclair/typebox';
|
|
14
|
-
import { TInteger } from '@sinclair/typebox';
|
|
15
|
-
import { TLiteral } from '@sinclair/typebox';
|
|
16
|
-
import { TNull } from '@sinclair/typebox';
|
|
17
|
-
import { TNumber } from '@sinclair/typebox';
|
|
18
|
-
import { TObject } from '@sinclair/typebox';
|
|
11
|
+
import { Static } from 'typebox';
|
|
12
|
+
import { TObject } from 'typebox';
|
|
19
13
|
import { ToolDefinition } from '@earendil-works/pi-coding-agent';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { TRecursive } from '@sinclair/typebox';
|
|
23
|
-
import { TRefUnsafe } from '@sinclair/typebox';
|
|
24
|
-
import { TSchema } from '@sinclair/typebox';
|
|
25
|
-
import { TString } from '@sinclair/typebox';
|
|
26
|
-
import { TThis } from '@sinclair/typebox';
|
|
27
|
-
import { TUnion } from '@sinclair/typebox';
|
|
28
|
-
import { TUnknown } from '@sinclair/typebox';
|
|
14
|
+
import { TSchema } from 'typebox';
|
|
15
|
+
import { Type } from 'typebox';
|
|
29
16
|
import { VM } from '@earendil-works/gondolin';
|
|
30
17
|
import { WriteOperations } from '@earendil-works/pi-coding-agent';
|
|
31
18
|
|
|
@@ -74,6 +61,23 @@ declare interface BuildAgentSessionArgs {
|
|
|
74
61
|
};
|
|
75
62
|
}
|
|
76
63
|
|
|
64
|
+
declare type ClaimCondition = {
|
|
65
|
+
op: 'all';
|
|
66
|
+
conditions: ClaimCondition[];
|
|
67
|
+
} | {
|
|
68
|
+
op: 'any';
|
|
69
|
+
conditions: ClaimCondition[];
|
|
70
|
+
} | {
|
|
71
|
+
op: 'task_status';
|
|
72
|
+
taskId: string;
|
|
73
|
+
statuses: TaskStatus[];
|
|
74
|
+
} | {
|
|
75
|
+
op: 'task_accepted';
|
|
76
|
+
taskId: string;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
declare const ClaimCondition: Type.TUnsafe<ClaimCondition>;
|
|
80
|
+
|
|
77
81
|
declare interface ClaimedTask {
|
|
78
82
|
/** The claimed task payload itself. */
|
|
79
83
|
task: Task;
|
|
@@ -105,10 +109,10 @@ declare interface ClaimedTask {
|
|
|
105
109
|
* short example skills, not the kind of skill the eval
|
|
106
110
|
* substrate is dogfooded on (#943, #823).
|
|
107
111
|
*/
|
|
108
|
-
declare const ContextRef: TObject<
|
|
109
|
-
slug: TString;
|
|
110
|
-
binding: TUnion<[TLiteral<"skill">, TLiteral<"context_inline">, TLiteral<"prompt_prefix">, TLiteral<"user_inline">]>;
|
|
111
|
-
content: TString;
|
|
112
|
+
declare const ContextRef: Type.TObject<{
|
|
113
|
+
slug: Type.TString;
|
|
114
|
+
binding: Type.TUnion<[Type.TLiteral<"skill">, Type.TLiteral<"context_inline">, Type.TLiteral<"prompt_prefix">, Type.TLiteral<"user_inline">]>;
|
|
115
|
+
content: Type.TString;
|
|
112
116
|
}>;
|
|
113
117
|
|
|
114
118
|
declare type ContextRef = Static<typeof ContextRef>;
|
|
@@ -671,8 +675,8 @@ export declare interface SubagentToolHandle {
|
|
|
671
675
|
* Resolved at call time; unknown names error.
|
|
672
676
|
*/
|
|
673
677
|
export declare const SubagentToolParameters: TObject<{
|
|
674
|
-
task: TString;
|
|
675
|
-
output_schema: TString;
|
|
678
|
+
task: Type.TString;
|
|
679
|
+
output_schema: Type.TString;
|
|
676
680
|
}>;
|
|
677
681
|
|
|
678
682
|
export declare type SubagentToolParameters = Static<typeof SubagentToolParameters>;
|
|
@@ -684,83 +688,70 @@ export declare type SubagentToolParameters = Static<typeof SubagentToolParameter
|
|
|
684
688
|
* `taskType`. Type-specific payload lives inside `input` (validated
|
|
685
689
|
* against the schema registered for `taskType`).
|
|
686
690
|
*/
|
|
687
|
-
declare const Task: TObject<
|
|
688
|
-
id: TString;
|
|
689
|
-
taskType: TString;
|
|
690
|
-
title: TUnion<[TString, TNull]>;
|
|
691
|
-
tags: TArray<TString>;
|
|
692
|
-
teamId: TString;
|
|
693
|
-
diaryId: TUnion<[TString, TNull]>;
|
|
694
|
-
outputKind: TUnion<[TLiteral<"artifact">, TLiteral<"judgment">]>;
|
|
695
|
-
input: TRecord<
|
|
696
|
-
inputSchemaCid: TString;
|
|
697
|
-
inputCid: TString;
|
|
698
|
-
references: TArray<TObject<
|
|
699
|
-
taskId: TUnion<[TString, TNull]>;
|
|
700
|
-
outputCid: TString;
|
|
701
|
-
role: TUnion<[TLiteral<"judged_work">, TLiteral<"reviewed_diff">, TLiteral<"target_source">, TLiteral<"context">]>;
|
|
702
|
-
external: TOptional<TObject<
|
|
703
|
-
kind: TUnion<[TLiteral<"github_pr">, TLiteral<"github_issue">, TLiteral<"http_url">]>;
|
|
704
|
-
pr: TOptional<TNumber>;
|
|
705
|
-
issue: TOptional<TNumber>;
|
|
706
|
-
url: TOptional<TString>;
|
|
707
|
-
commit_sha: TOptional<TString>;
|
|
708
|
-
snapshot_cid: TOptional<TString>;
|
|
691
|
+
declare const Task: Type.TObject<{
|
|
692
|
+
id: Type.TString;
|
|
693
|
+
taskType: Type.TString;
|
|
694
|
+
title: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
695
|
+
tags: Type.TArray<Type.TString>;
|
|
696
|
+
teamId: Type.TString;
|
|
697
|
+
diaryId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
698
|
+
outputKind: Type.TUnion<[Type.TLiteral<"artifact">, Type.TLiteral<"judgment">]>;
|
|
699
|
+
input: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
700
|
+
inputSchemaCid: Type.TString;
|
|
701
|
+
inputCid: Type.TString;
|
|
702
|
+
references: Type.TArray<Type.TObject<{
|
|
703
|
+
taskId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
704
|
+
outputCid: Type.TString;
|
|
705
|
+
role: Type.TUnion<[Type.TLiteral<"judged_work">, Type.TLiteral<"reviewed_diff">, Type.TLiteral<"target_source">, Type.TLiteral<"context">]>;
|
|
706
|
+
external: Type.TOptional<Type.TObject<{
|
|
707
|
+
kind: Type.TUnion<[Type.TLiteral<"github_pr">, Type.TLiteral<"github_issue">, Type.TLiteral<"http_url">]>;
|
|
708
|
+
pr: Type.TOptional<Type.TNumber>;
|
|
709
|
+
issue: Type.TOptional<Type.TNumber>;
|
|
710
|
+
url: Type.TOptional<Type.TString>;
|
|
711
|
+
commit_sha: Type.TOptional<Type.TString>;
|
|
712
|
+
snapshot_cid: Type.TOptional<Type.TString>;
|
|
709
713
|
}>>;
|
|
710
714
|
}>>;
|
|
711
|
-
correlationId: TUnion<[TString, TNull]>;
|
|
712
|
-
proposedByAgentId: TUnion<[TString, TNull]>;
|
|
713
|
-
proposedByHumanId: TUnion<[TString, TNull]>;
|
|
714
|
-
acceptedAttemptN: TUnion<[TNumber, TNull]>;
|
|
715
|
-
claimCondition: TUnion<[
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
conditions: TArray<TThis>;
|
|
721
|
-
}>, TObject< {
|
|
722
|
-
op: TLiteral<"task_status">;
|
|
723
|
-
taskId: TString;
|
|
724
|
-
statuses: TArray<TRefUnsafe<TUnion<[TLiteral<"waiting">, TLiteral<"queued">, TLiteral<"dispatched">, TLiteral<"running">, TLiteral<"completed">, TLiteral<"failed">, TLiteral<"cancelled">, TLiteral<"expired">]>>>;
|
|
725
|
-
}>, TObject< {
|
|
726
|
-
op: TLiteral<"task_accepted">;
|
|
727
|
-
taskId: TString;
|
|
728
|
-
}>]>>, TNull]>;
|
|
729
|
-
requiredExecutorTrustLevel: TUnion<[TLiteral<"selfDeclared">, TLiteral<"agentSigned">, TLiteral<"releaseVerifiedTool">, TLiteral<"sandboxAttested">]>;
|
|
730
|
-
allowedExecutors: TArray<TObject< {
|
|
731
|
-
provider: TString;
|
|
732
|
-
model: TString;
|
|
715
|
+
correlationId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
716
|
+
proposedByAgentId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
717
|
+
proposedByHumanId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
718
|
+
acceptedAttemptN: Type.TUnion<[Type.TNumber, Type.TNull]>;
|
|
719
|
+
claimCondition: Type.TUnion<[Type.TUnsafe<ClaimCondition>, Type.TNull]>;
|
|
720
|
+
requiredExecutorTrustLevel: Type.TUnion<[Type.TLiteral<"selfDeclared">, Type.TLiteral<"agentSigned">, Type.TLiteral<"releaseVerifiedTool">, Type.TLiteral<"sandboxAttested">]>;
|
|
721
|
+
allowedExecutors: Type.TArray<Type.TObject<{
|
|
722
|
+
provider: Type.TString;
|
|
723
|
+
model: Type.TString;
|
|
733
724
|
}>>;
|
|
734
|
-
status: TUnion<[TLiteral<"waiting">, TLiteral<"queued">, TLiteral<"dispatched">, TLiteral<"running">, TLiteral<"completed">, TLiteral<"failed">, TLiteral<"cancelled">, TLiteral<"expired">]>;
|
|
735
|
-
queuedAt: TString;
|
|
736
|
-
completedAt: TUnion<[TString, TNull]>;
|
|
737
|
-
expiresAt: TUnion<[TString, TNull]>;
|
|
738
|
-
cancelledByAgentId: TUnion<[TString, TNull]>;
|
|
739
|
-
cancelledByHumanId: TUnion<[TString, TNull]>;
|
|
740
|
-
cancelReason: TUnion<[TString, TNull]>;
|
|
741
|
-
maxAttempts: TNumber;
|
|
742
|
-
dispatchTimeoutSec: TUnion<[TInteger, TNull]>;
|
|
743
|
-
runningTimeoutSec: TUnion<[TInteger, TNull]>;
|
|
725
|
+
status: Type.TUnion<[Type.TLiteral<"waiting">, Type.TLiteral<"queued">, Type.TLiteral<"dispatched">, Type.TLiteral<"running">, Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"cancelled">, Type.TLiteral<"expired">]>;
|
|
726
|
+
queuedAt: Type.TString;
|
|
727
|
+
completedAt: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
728
|
+
expiresAt: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
729
|
+
cancelledByAgentId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
730
|
+
cancelledByHumanId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
731
|
+
cancelReason: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
732
|
+
maxAttempts: Type.TNumber;
|
|
733
|
+
dispatchTimeoutSec: Type.TUnion<[Type.TInteger, Type.TNull]>;
|
|
734
|
+
runningTimeoutSec: Type.TUnion<[Type.TInteger, Type.TNull]>;
|
|
744
735
|
}>;
|
|
745
736
|
|
|
746
737
|
declare type Task = Static<typeof Task>;
|
|
747
738
|
|
|
748
739
|
/** Reusable input fragment for any task type. Soft cap at 5 items. */
|
|
749
|
-
declare const TaskContext: TArray<TObject<
|
|
750
|
-
slug: TString;
|
|
751
|
-
binding: TUnion<[TLiteral<"skill">, TLiteral<"context_inline">, TLiteral<"prompt_prefix">, TLiteral<"user_inline">]>;
|
|
752
|
-
content: TString;
|
|
740
|
+
declare const TaskContext: Type.TArray<Type.TObject<{
|
|
741
|
+
slug: Type.TString;
|
|
742
|
+
binding: Type.TUnion<[Type.TLiteral<"skill">, Type.TLiteral<"context_inline">, Type.TLiteral<"prompt_prefix">, Type.TLiteral<"user_inline">]>;
|
|
743
|
+
content: Type.TString;
|
|
753
744
|
}>>;
|
|
754
745
|
|
|
755
746
|
declare type TaskContext = Static<typeof TaskContext>;
|
|
756
747
|
|
|
757
|
-
declare const TaskMessage: TObject<
|
|
758
|
-
taskId: TString;
|
|
759
|
-
attemptN: TNumber;
|
|
760
|
-
seq: TNumber;
|
|
761
|
-
timestamp: TString;
|
|
762
|
-
kind: TUnion<[TLiteral<"text_delta">, TLiteral<"tool_call_start">, TLiteral<"tool_call_end">, TLiteral<"turn_end">, TLiteral<"error">, TLiteral<"info">]>;
|
|
763
|
-
payload: TRecord<
|
|
748
|
+
declare const TaskMessage: Type.TObject<{
|
|
749
|
+
taskId: Type.TString;
|
|
750
|
+
attemptN: Type.TNumber;
|
|
751
|
+
seq: Type.TNumber;
|
|
752
|
+
timestamp: Type.TString;
|
|
753
|
+
kind: Type.TUnion<[Type.TLiteral<"text_delta">, Type.TLiteral<"tool_call_start">, Type.TLiteral<"tool_call_end">, Type.TLiteral<"turn_end">, Type.TLiteral<"error">, Type.TLiteral<"info">]>;
|
|
754
|
+
payload: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
764
755
|
}>;
|
|
765
756
|
|
|
766
757
|
declare type TaskMessage = Static<typeof TaskMessage>;
|
|
@@ -770,29 +761,29 @@ declare type TaskMessage = Static<typeof TaskMessage>;
|
|
|
770
761
|
* the compact shape the runtime surfaces back to whoever drove it
|
|
771
762
|
* (stdout reporter, API reporter in PR 7, etc.).
|
|
772
763
|
*/
|
|
773
|
-
declare const TaskOutput: TObject<
|
|
774
|
-
taskId: TString;
|
|
775
|
-
attemptN: TNumber;
|
|
776
|
-
status: TUnion<[TLiteral<"completed">, TLiteral<"failed">, TLiteral<"cancelled">]>;
|
|
777
|
-
output: TUnion<[TRecord<
|
|
778
|
-
outputCid: TUnion<[TString, TNull]>;
|
|
779
|
-
usage: TObject<
|
|
780
|
-
inputTokens: TInteger;
|
|
781
|
-
outputTokens: TInteger;
|
|
782
|
-
cacheReadTokens: TOptional<TInteger>;
|
|
783
|
-
cacheWriteTokens: TOptional<TInteger>;
|
|
784
|
-
toolCalls: TOptional<TInteger>;
|
|
785
|
-
model: TOptional<TString>;
|
|
786
|
-
provider: TOptional<TString>;
|
|
764
|
+
declare const TaskOutput: Type.TObject<{
|
|
765
|
+
taskId: Type.TString;
|
|
766
|
+
attemptN: Type.TNumber;
|
|
767
|
+
status: Type.TUnion<[Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"cancelled">]>;
|
|
768
|
+
output: Type.TUnion<[Type.TRecord<"^.*$", Type.TUnknown>, Type.TNull]>;
|
|
769
|
+
outputCid: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
770
|
+
usage: Type.TObject<{
|
|
771
|
+
inputTokens: Type.TInteger;
|
|
772
|
+
outputTokens: Type.TInteger;
|
|
773
|
+
cacheReadTokens: Type.TOptional<Type.TInteger>;
|
|
774
|
+
cacheWriteTokens: Type.TOptional<Type.TInteger>;
|
|
775
|
+
toolCalls: Type.TOptional<Type.TInteger>;
|
|
776
|
+
model: Type.TOptional<Type.TString>;
|
|
777
|
+
provider: Type.TOptional<Type.TString>;
|
|
787
778
|
}>;
|
|
788
|
-
durationMs: TNumber;
|
|
789
|
-
error: TOptional<TObject<
|
|
790
|
-
code: TString;
|
|
791
|
-
message: TString;
|
|
792
|
-
stack: TOptional<TString>;
|
|
793
|
-
retryable: TOptional<TBoolean>;
|
|
779
|
+
durationMs: Type.TNumber;
|
|
780
|
+
error: Type.TOptional<Type.TObject<{
|
|
781
|
+
code: Type.TString;
|
|
782
|
+
message: Type.TString;
|
|
783
|
+
stack: Type.TOptional<Type.TString>;
|
|
784
|
+
retryable: Type.TOptional<Type.TBoolean>;
|
|
794
785
|
}>>;
|
|
795
|
-
contentSignature: TOptional<TString>;
|
|
786
|
+
contentSignature: Type.TOptional<Type.TString>;
|
|
796
787
|
}>;
|
|
797
788
|
|
|
798
789
|
declare type TaskOutput = Static<typeof TaskOutput>;
|
|
@@ -855,19 +846,23 @@ declare interface TaskReporter {
|
|
|
855
846
|
readonly cancelReason: string | null;
|
|
856
847
|
}
|
|
857
848
|
|
|
849
|
+
declare const TaskStatus: Type.TUnion<[Type.TLiteral<"waiting">, Type.TLiteral<"queued">, Type.TLiteral<"dispatched">, Type.TLiteral<"running">, Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"cancelled">, Type.TLiteral<"expired">]>;
|
|
850
|
+
|
|
851
|
+
declare type TaskStatus = Static<typeof TaskStatus>;
|
|
852
|
+
|
|
858
853
|
/**
|
|
859
854
|
* Token / cost accounting for one attempt.
|
|
860
855
|
* Reported by the runtime; persisted per-attempt, also rolled up into
|
|
861
856
|
* `TaskOutput.usage` for convenience.
|
|
862
857
|
*/
|
|
863
|
-
declare const TaskUsage: TObject<
|
|
864
|
-
inputTokens: TInteger;
|
|
865
|
-
outputTokens: TInteger;
|
|
866
|
-
cacheReadTokens: TOptional<TInteger>;
|
|
867
|
-
cacheWriteTokens: TOptional<TInteger>;
|
|
868
|
-
toolCalls: TOptional<TInteger>;
|
|
869
|
-
model: TOptional<TString>;
|
|
870
|
-
provider: TOptional<TString>;
|
|
858
|
+
declare const TaskUsage: Type.TObject<{
|
|
859
|
+
inputTokens: Type.TInteger;
|
|
860
|
+
outputTokens: Type.TInteger;
|
|
861
|
+
cacheReadTokens: Type.TOptional<Type.TInteger>;
|
|
862
|
+
cacheWriteTokens: Type.TOptional<Type.TInteger>;
|
|
863
|
+
toolCalls: Type.TOptional<Type.TInteger>;
|
|
864
|
+
model: Type.TOptional<Type.TString>;
|
|
865
|
+
provider: Type.TOptional<Type.TString>;
|
|
871
866
|
}>;
|
|
872
867
|
|
|
873
868
|
declare type TaskUsage = Static<typeof TaskUsage>;
|