@xenosystem/agent-sdk 0.10.34 → 0.10.36
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 +34 -1
- package/dist/artifacts/index.cjs +1 -1
- package/dist/artifacts/index.js +1 -1
- package/dist/automation/index.cjs +1 -1
- package/dist/automation/index.js +1 -1
- package/dist/control-plane/index.cjs +1 -1
- package/dist/control-plane/index.js +1 -1
- package/dist/coordination/index.cjs +2 -2
- package/dist/coordination/index.js +2 -2
- package/dist/coordination/metafile-cjs.json +1 -1
- package/dist/coordination/metafile-esm.json +1 -1
- package/dist/electron/index.cjs +215 -201
- package/dist/electron/index.d.cts +67 -1
- package/dist/electron/index.d.ts +67 -1
- package/dist/electron/index.js +215 -201
- package/dist/electron/metafile-cjs.json +1 -1
- package/dist/electron/metafile-esm.json +1 -1
- package/dist/index.cjs +384 -379
- package/dist/index.d.cts +118 -36
- package/dist/index.d.ts +118 -36
- package/dist/index.js +384 -379
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/providers/index.cjs +10 -10
- package/dist/providers/index.d.cts +49 -33
- package/dist/providers/index.d.ts +49 -33
- package/dist/providers/index.js +10 -10
- package/dist/providers/metafile-cjs.json +1 -1
- package/dist/providers/metafile-esm.json +1 -1
- package/dist/session/index.cjs +1 -1
- package/dist/session/index.js +1 -1
- package/dist/utils/index.cjs +15 -15
- package/dist/utils/index.d.cts +15 -2
- package/dist/utils/index.d.ts +15 -2
- package/dist/utils/index.js +14 -14
- package/dist/utils/metafile-cjs.json +1 -1
- package/dist/utils/metafile-esm.json +1 -1
- package/dist/workforce/index.cjs +1 -1
- package/dist/workforce/index.d.cts +7 -2
- package/dist/workforce/index.d.ts +7 -2
- package/dist/workforce/index.js +1 -1
- package/dist/workforce/metafile-cjs.json +1 -1
- package/dist/workforce/metafile-esm.json +1 -1
- package/ownership/ownership-policy.json +2 -2
- package/package.json +1 -1
|
@@ -780,6 +780,44 @@ declare class PermissionEngine {
|
|
|
780
780
|
private normalizeCommandText;
|
|
781
781
|
private resolveTargetPath;
|
|
782
782
|
}
|
|
783
|
+
type HookEventName = "SessionStart" | "UserPromptSubmit" | "PermissionRequest" | "PreToolUse" | "PostToolUse" | "PreCompact" | "PostCompact" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop";
|
|
784
|
+
interface BaseHookDefinition {
|
|
785
|
+
name?: string;
|
|
786
|
+
events?: HookEventName[];
|
|
787
|
+
timeoutMs?: number;
|
|
788
|
+
maxOutputBytes?: number;
|
|
789
|
+
failClosed?: boolean;
|
|
790
|
+
async?: boolean;
|
|
791
|
+
}
|
|
792
|
+
interface CommandHookDefinition extends BaseHookDefinition {
|
|
793
|
+
type: "command";
|
|
794
|
+
command: string;
|
|
795
|
+
args?: string[];
|
|
796
|
+
cwd?: string;
|
|
797
|
+
shell?: boolean;
|
|
798
|
+
env?: Record<string, string>;
|
|
799
|
+
}
|
|
800
|
+
interface HttpHookDefinition extends BaseHookDefinition {
|
|
801
|
+
type: "http";
|
|
802
|
+
url: string;
|
|
803
|
+
method?: "POST";
|
|
804
|
+
headers?: Record<string, string>;
|
|
805
|
+
}
|
|
806
|
+
interface PromptHookDefinition extends BaseHookDefinition {
|
|
807
|
+
type: "prompt";
|
|
808
|
+
prompt: string;
|
|
809
|
+
}
|
|
810
|
+
interface AgentHookDefinition extends BaseHookDefinition {
|
|
811
|
+
type: "agent";
|
|
812
|
+
prompt: string;
|
|
813
|
+
agent?: string;
|
|
814
|
+
model?: string;
|
|
815
|
+
}
|
|
816
|
+
type HookDefinition = CommandHookDefinition | HttpHookDefinition | PromptHookDefinition | AgentHookDefinition;
|
|
817
|
+
interface HookConfig {
|
|
818
|
+
hooks?: HookDefinition[];
|
|
819
|
+
events?: Partial<Record<HookEventName, HookDefinition[]>>;
|
|
820
|
+
}
|
|
783
821
|
type ToolFailureCategory = "schema" | "missing_path" | "permission_denied" | "transport" | "timeout" | "tool_failure";
|
|
784
822
|
interface ToolFailureGuardTrip {
|
|
785
823
|
category: ToolFailureCategory;
|
|
@@ -877,6 +915,13 @@ interface LlmClientDeps {
|
|
|
877
915
|
dpop?: string;
|
|
878
916
|
} | null>;
|
|
879
917
|
readonly requestContext?: Readonly<XenoRequestContext>;
|
|
918
|
+
authorizeRunDispatch?(target: {
|
|
919
|
+
model: string;
|
|
920
|
+
url: string;
|
|
921
|
+
authorization: string | undefined;
|
|
922
|
+
maxOutputTokens: number;
|
|
923
|
+
}, signal: AbortSignal): Promise<Record<string, string>>;
|
|
924
|
+
hasRunAdmission?(): boolean;
|
|
880
925
|
readonly maxTokens: number;
|
|
881
926
|
getApiRequestTimeoutMs(): number;
|
|
882
927
|
getStreamDeadlines?(): {
|
|
@@ -940,6 +985,12 @@ declare class LlmClient {
|
|
|
940
985
|
private createRequestDeadline;
|
|
941
986
|
private streamingMemoryKey;
|
|
942
987
|
private static normalizeRequestError;
|
|
988
|
+
private preparedDispatch?;
|
|
989
|
+
prepareRunDispatch(model: string, signal: AbortSignal): Promise<void>;
|
|
990
|
+
clearPreparedRunDispatch(): void;
|
|
991
|
+
private dispatch;
|
|
992
|
+
private requestSecrets;
|
|
993
|
+
private static typedRequestFailure;
|
|
943
994
|
callChatCompletionsNonStream(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal, maxOutputTokens?: number): Promise<StreamResult>;
|
|
944
995
|
private throwForErrorResponse;
|
|
945
996
|
callChatCompletions(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal, maxOutputTokens?: number): Promise<StreamResult>;
|
|
@@ -1493,8 +1544,13 @@ interface RunAuthorityToolCall {
|
|
|
1493
1544
|
toolName: string;
|
|
1494
1545
|
toolCallId: string;
|
|
1495
1546
|
}
|
|
1547
|
+
interface RunDispatchCredential {
|
|
1548
|
+
readonly admissionId: string;
|
|
1549
|
+
readonly lease: string;
|
|
1550
|
+
}
|
|
1496
1551
|
interface RunAuthority {
|
|
1497
|
-
|
|
1552
|
+
readonly admissionId?: string;
|
|
1553
|
+
authorizeDispatch(request: Readonly<RunAuthorityDispatch>, signal: AbortSignal): void | RunDispatchCredential | Promise<void | RunDispatchCredential>;
|
|
1498
1554
|
authorizeToolCall(request: Readonly<RunAuthorityToolCall>, signal: AbortSignal): void | Promise<void>;
|
|
1499
1555
|
}
|
|
1500
1556
|
interface ModeSwitchRequest {
|
|
@@ -1540,6 +1596,7 @@ interface AgentLoopConfig {
|
|
|
1540
1596
|
onIteration?: (iteration: number, totalTokens: number) => void;
|
|
1541
1597
|
modelWorkAccounting?: ModelWorkAccounting;
|
|
1542
1598
|
runAuthority?: RunAuthority;
|
|
1599
|
+
hooks?: HookConfig;
|
|
1543
1600
|
onError?: (error: Error, context: string) => void;
|
|
1544
1601
|
onTranscriptError?: (error: Error, context: string) => void;
|
|
1545
1602
|
onModeSwitchRequest?: (request: ModeSwitchRequest) => Promise<boolean>;
|
|
@@ -1651,6 +1708,7 @@ declare class AgentLoop {
|
|
|
1651
1708
|
private activeTaskPrompt;
|
|
1652
1709
|
private activeToolPolicy;
|
|
1653
1710
|
private apiFailureDiagnosticsLogged;
|
|
1711
|
+
private lastProviderOverflowDetail;
|
|
1654
1712
|
private queryLifecycle;
|
|
1655
1713
|
private toolWaitDepth;
|
|
1656
1714
|
private watchdogReason;
|
|
@@ -1663,6 +1721,7 @@ declare class AgentLoop {
|
|
|
1663
1721
|
private readonly promptSections;
|
|
1664
1722
|
private readonly completionGuards;
|
|
1665
1723
|
private readonly toolFailureGuard;
|
|
1724
|
+
private readonly preToolUseGate;
|
|
1666
1725
|
private turnToolCalls;
|
|
1667
1726
|
private turnToolFailures;
|
|
1668
1727
|
private turnFailuresByTool;
|
|
@@ -1737,6 +1796,7 @@ declare class AgentLoop {
|
|
|
1737
1796
|
private currentTurnStats;
|
|
1738
1797
|
private appendAuditEvent;
|
|
1739
1798
|
private setExecutionModeInternal;
|
|
1799
|
+
private redactProviderDiagnostic;
|
|
1740
1800
|
private maybeAppendApiRequestFailureAudit;
|
|
1741
1801
|
private static parsePositiveInteger;
|
|
1742
1802
|
private sleep;
|
|
@@ -1908,6 +1968,8 @@ type AgentToAppChannel = keyof AgentToAppMessages;
|
|
|
1908
1968
|
type AppToAgentChannel = keyof AppToAgentMessages;
|
|
1909
1969
|
type AgentIpcChannel = AgentToAppChannel | AppToAgentChannel;
|
|
1910
1970
|
type IpcHandler<C extends string, M extends Record<string, unknown>> = C extends keyof M ? (payload: M[C]) => void : never;
|
|
1971
|
+
type ProviderErrorCategory = "authentication" | "authorization" | "unsupported_model" | "unsupported_capability" | "rate_limit" | "context_overflow" | "safety_refusal" | "timeout" | "disconnect" | "malformed_response" | "server" | "transport" | "endpoint_policy" | "cancelled";
|
|
1972
|
+
type ProviderErrorCode = "PROVIDER_AUTHENTICATION_FAILED" | "PROVIDER_AUTHORIZATION_FAILED" | "PROVIDER_MODEL_UNSUPPORTED" | "PROVIDER_CAPABILITY_UNSUPPORTED" | "PROVIDER_RATE_LIMITED" | "PROVIDER_CONTEXT_OVERFLOW" | "PROVIDER_SAFETY_REFUSAL" | "PROVIDER_TIMEOUT" | "PROVIDER_DISCONNECTED" | "PROVIDER_MALFORMED_RESPONSE" | "PROVIDER_SERVER_ERROR" | "PROVIDER_TRANSPORT_ERROR" | "PROVIDER_ENDPOINT_REJECTED" | "PROVIDER_CANCELLED";
|
|
1911
1973
|
type DualLLMMode = "auto" | "local" | "cloud";
|
|
1912
1974
|
interface ChatParams {
|
|
1913
1975
|
messages: Array<{
|
|
@@ -1932,6 +1994,10 @@ interface ChatResponse {
|
|
|
1932
1994
|
totalTokens: number;
|
|
1933
1995
|
};
|
|
1934
1996
|
error?: string;
|
|
1997
|
+
errorCode?: ProviderErrorCode;
|
|
1998
|
+
errorCategory?: ProviderErrorCategory;
|
|
1999
|
+
retryable?: boolean;
|
|
2000
|
+
statusCode?: number;
|
|
1935
2001
|
}
|
|
1936
2002
|
interface DualLLMStatus {
|
|
1937
2003
|
mode: DualLLMMode;
|
package/dist/electron/index.d.ts
CHANGED
|
@@ -780,6 +780,44 @@ declare class PermissionEngine {
|
|
|
780
780
|
private normalizeCommandText;
|
|
781
781
|
private resolveTargetPath;
|
|
782
782
|
}
|
|
783
|
+
type HookEventName = "SessionStart" | "UserPromptSubmit" | "PermissionRequest" | "PreToolUse" | "PostToolUse" | "PreCompact" | "PostCompact" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop";
|
|
784
|
+
interface BaseHookDefinition {
|
|
785
|
+
name?: string;
|
|
786
|
+
events?: HookEventName[];
|
|
787
|
+
timeoutMs?: number;
|
|
788
|
+
maxOutputBytes?: number;
|
|
789
|
+
failClosed?: boolean;
|
|
790
|
+
async?: boolean;
|
|
791
|
+
}
|
|
792
|
+
interface CommandHookDefinition extends BaseHookDefinition {
|
|
793
|
+
type: "command";
|
|
794
|
+
command: string;
|
|
795
|
+
args?: string[];
|
|
796
|
+
cwd?: string;
|
|
797
|
+
shell?: boolean;
|
|
798
|
+
env?: Record<string, string>;
|
|
799
|
+
}
|
|
800
|
+
interface HttpHookDefinition extends BaseHookDefinition {
|
|
801
|
+
type: "http";
|
|
802
|
+
url: string;
|
|
803
|
+
method?: "POST";
|
|
804
|
+
headers?: Record<string, string>;
|
|
805
|
+
}
|
|
806
|
+
interface PromptHookDefinition extends BaseHookDefinition {
|
|
807
|
+
type: "prompt";
|
|
808
|
+
prompt: string;
|
|
809
|
+
}
|
|
810
|
+
interface AgentHookDefinition extends BaseHookDefinition {
|
|
811
|
+
type: "agent";
|
|
812
|
+
prompt: string;
|
|
813
|
+
agent?: string;
|
|
814
|
+
model?: string;
|
|
815
|
+
}
|
|
816
|
+
type HookDefinition = CommandHookDefinition | HttpHookDefinition | PromptHookDefinition | AgentHookDefinition;
|
|
817
|
+
interface HookConfig {
|
|
818
|
+
hooks?: HookDefinition[];
|
|
819
|
+
events?: Partial<Record<HookEventName, HookDefinition[]>>;
|
|
820
|
+
}
|
|
783
821
|
type ToolFailureCategory = "schema" | "missing_path" | "permission_denied" | "transport" | "timeout" | "tool_failure";
|
|
784
822
|
interface ToolFailureGuardTrip {
|
|
785
823
|
category: ToolFailureCategory;
|
|
@@ -877,6 +915,13 @@ interface LlmClientDeps {
|
|
|
877
915
|
dpop?: string;
|
|
878
916
|
} | null>;
|
|
879
917
|
readonly requestContext?: Readonly<XenoRequestContext>;
|
|
918
|
+
authorizeRunDispatch?(target: {
|
|
919
|
+
model: string;
|
|
920
|
+
url: string;
|
|
921
|
+
authorization: string | undefined;
|
|
922
|
+
maxOutputTokens: number;
|
|
923
|
+
}, signal: AbortSignal): Promise<Record<string, string>>;
|
|
924
|
+
hasRunAdmission?(): boolean;
|
|
880
925
|
readonly maxTokens: number;
|
|
881
926
|
getApiRequestTimeoutMs(): number;
|
|
882
927
|
getStreamDeadlines?(): {
|
|
@@ -940,6 +985,12 @@ declare class LlmClient {
|
|
|
940
985
|
private createRequestDeadline;
|
|
941
986
|
private streamingMemoryKey;
|
|
942
987
|
private static normalizeRequestError;
|
|
988
|
+
private preparedDispatch?;
|
|
989
|
+
prepareRunDispatch(model: string, signal: AbortSignal): Promise<void>;
|
|
990
|
+
clearPreparedRunDispatch(): void;
|
|
991
|
+
private dispatch;
|
|
992
|
+
private requestSecrets;
|
|
993
|
+
private static typedRequestFailure;
|
|
943
994
|
callChatCompletionsNonStream(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal, maxOutputTokens?: number): Promise<StreamResult>;
|
|
944
995
|
private throwForErrorResponse;
|
|
945
996
|
callChatCompletions(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal, maxOutputTokens?: number): Promise<StreamResult>;
|
|
@@ -1493,8 +1544,13 @@ interface RunAuthorityToolCall {
|
|
|
1493
1544
|
toolName: string;
|
|
1494
1545
|
toolCallId: string;
|
|
1495
1546
|
}
|
|
1547
|
+
interface RunDispatchCredential {
|
|
1548
|
+
readonly admissionId: string;
|
|
1549
|
+
readonly lease: string;
|
|
1550
|
+
}
|
|
1496
1551
|
interface RunAuthority {
|
|
1497
|
-
|
|
1552
|
+
readonly admissionId?: string;
|
|
1553
|
+
authorizeDispatch(request: Readonly<RunAuthorityDispatch>, signal: AbortSignal): void | RunDispatchCredential | Promise<void | RunDispatchCredential>;
|
|
1498
1554
|
authorizeToolCall(request: Readonly<RunAuthorityToolCall>, signal: AbortSignal): void | Promise<void>;
|
|
1499
1555
|
}
|
|
1500
1556
|
interface ModeSwitchRequest {
|
|
@@ -1540,6 +1596,7 @@ interface AgentLoopConfig {
|
|
|
1540
1596
|
onIteration?: (iteration: number, totalTokens: number) => void;
|
|
1541
1597
|
modelWorkAccounting?: ModelWorkAccounting;
|
|
1542
1598
|
runAuthority?: RunAuthority;
|
|
1599
|
+
hooks?: HookConfig;
|
|
1543
1600
|
onError?: (error: Error, context: string) => void;
|
|
1544
1601
|
onTranscriptError?: (error: Error, context: string) => void;
|
|
1545
1602
|
onModeSwitchRequest?: (request: ModeSwitchRequest) => Promise<boolean>;
|
|
@@ -1651,6 +1708,7 @@ declare class AgentLoop {
|
|
|
1651
1708
|
private activeTaskPrompt;
|
|
1652
1709
|
private activeToolPolicy;
|
|
1653
1710
|
private apiFailureDiagnosticsLogged;
|
|
1711
|
+
private lastProviderOverflowDetail;
|
|
1654
1712
|
private queryLifecycle;
|
|
1655
1713
|
private toolWaitDepth;
|
|
1656
1714
|
private watchdogReason;
|
|
@@ -1663,6 +1721,7 @@ declare class AgentLoop {
|
|
|
1663
1721
|
private readonly promptSections;
|
|
1664
1722
|
private readonly completionGuards;
|
|
1665
1723
|
private readonly toolFailureGuard;
|
|
1724
|
+
private readonly preToolUseGate;
|
|
1666
1725
|
private turnToolCalls;
|
|
1667
1726
|
private turnToolFailures;
|
|
1668
1727
|
private turnFailuresByTool;
|
|
@@ -1737,6 +1796,7 @@ declare class AgentLoop {
|
|
|
1737
1796
|
private currentTurnStats;
|
|
1738
1797
|
private appendAuditEvent;
|
|
1739
1798
|
private setExecutionModeInternal;
|
|
1799
|
+
private redactProviderDiagnostic;
|
|
1740
1800
|
private maybeAppendApiRequestFailureAudit;
|
|
1741
1801
|
private static parsePositiveInteger;
|
|
1742
1802
|
private sleep;
|
|
@@ -1908,6 +1968,8 @@ type AgentToAppChannel = keyof AgentToAppMessages;
|
|
|
1908
1968
|
type AppToAgentChannel = keyof AppToAgentMessages;
|
|
1909
1969
|
type AgentIpcChannel = AgentToAppChannel | AppToAgentChannel;
|
|
1910
1970
|
type IpcHandler<C extends string, M extends Record<string, unknown>> = C extends keyof M ? (payload: M[C]) => void : never;
|
|
1971
|
+
type ProviderErrorCategory = "authentication" | "authorization" | "unsupported_model" | "unsupported_capability" | "rate_limit" | "context_overflow" | "safety_refusal" | "timeout" | "disconnect" | "malformed_response" | "server" | "transport" | "endpoint_policy" | "cancelled";
|
|
1972
|
+
type ProviderErrorCode = "PROVIDER_AUTHENTICATION_FAILED" | "PROVIDER_AUTHORIZATION_FAILED" | "PROVIDER_MODEL_UNSUPPORTED" | "PROVIDER_CAPABILITY_UNSUPPORTED" | "PROVIDER_RATE_LIMITED" | "PROVIDER_CONTEXT_OVERFLOW" | "PROVIDER_SAFETY_REFUSAL" | "PROVIDER_TIMEOUT" | "PROVIDER_DISCONNECTED" | "PROVIDER_MALFORMED_RESPONSE" | "PROVIDER_SERVER_ERROR" | "PROVIDER_TRANSPORT_ERROR" | "PROVIDER_ENDPOINT_REJECTED" | "PROVIDER_CANCELLED";
|
|
1911
1973
|
type DualLLMMode = "auto" | "local" | "cloud";
|
|
1912
1974
|
interface ChatParams {
|
|
1913
1975
|
messages: Array<{
|
|
@@ -1932,6 +1994,10 @@ interface ChatResponse {
|
|
|
1932
1994
|
totalTokens: number;
|
|
1933
1995
|
};
|
|
1934
1996
|
error?: string;
|
|
1997
|
+
errorCode?: ProviderErrorCode;
|
|
1998
|
+
errorCategory?: ProviderErrorCategory;
|
|
1999
|
+
retryable?: boolean;
|
|
2000
|
+
statusCode?: number;
|
|
1935
2001
|
}
|
|
1936
2002
|
interface DualLLMStatus {
|
|
1937
2003
|
mode: DualLLMMode;
|