@dam-agents/cli 0.2.17 → 0.2.18-rc2
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/bin.js +2063 -1254
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -26748,319 +26748,170 @@ var liveEventSchema = external_exports.discriminatedUnion("topic", [
|
|
|
26748
26748
|
experimentId: external_exports.string().min(1),
|
|
26749
26749
|
agentId: external_exports.string().min(1)
|
|
26750
26750
|
}),
|
|
26751
|
+
external_exports.object({
|
|
26752
|
+
topic: external_exports.literal("attention"),
|
|
26753
|
+
agentId: external_exports.string().min(1)
|
|
26754
|
+
}),
|
|
26751
26755
|
external_exports.object({
|
|
26752
26756
|
topic: external_exports.literal("artifacts"),
|
|
26753
26757
|
artifactId: external_exports.string().min(1).optional(),
|
|
26754
26758
|
agentId: external_exports.string().min(1).optional()
|
|
26755
26759
|
})
|
|
26756
26760
|
]);
|
|
26757
|
-
var podSessionsNoticeSchema = external_exports.discriminatedUnion("topic", [
|
|
26758
|
-
external_exports.object({ topic: external_exports.literal("sync") }),
|
|
26759
|
-
external_exports.object({ topic: external_exports.literal("sessions"), agentId: external_exports.string().min(1) })
|
|
26760
|
-
]);
|
|
26761
26761
|
|
|
26762
|
-
// ../api-server-api/src/modules/
|
|
26763
|
-
var
|
|
26764
|
-
var
|
|
26765
|
-
|
|
26766
|
-
|
|
26767
|
-
|
|
26768
|
-
|
|
26769
|
-
|
|
26770
|
-
|
|
26771
|
-
|
|
26772
|
-
}
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
|
|
26776
|
-
}
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
|
|
26781
|
-
|
|
26782
|
-
|
|
26783
|
-
|
|
26784
|
-
}
|
|
26785
|
-
|
|
26786
|
-
|
|
26787
|
-
|
|
26788
|
-
|
|
26789
|
-
}
|
|
26790
|
-
var
|
|
26791
|
-
|
|
26792
|
-
|
|
26793
|
-
|
|
26794
|
-
|
|
26795
|
-
|
|
26796
|
-
|
|
26797
|
-
|
|
26798
|
-
|
|
26799
|
-
|
|
26800
|
-
|
|
26801
|
-
|
|
26802
|
-
|
|
26803
|
-
|
|
26804
|
-
|
|
26805
|
-
|
|
26806
|
-
|
|
26807
|
-
|
|
26808
|
-
|
|
26809
|
-
|
|
26810
|
-
|
|
26811
|
-
|
|
26812
|
-
|
|
26813
|
-
|
|
26814
|
-
|
|
26815
|
-
|
|
26816
|
-
|
|
26817
|
-
|
|
26818
|
-
|
|
26819
|
-
|
|
26820
|
-
|
|
26821
|
-
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26825
|
-
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
26833
|
-
|
|
26834
|
-
|
|
26835
|
-
|
|
26836
|
-
|
|
26837
|
-
|
|
26838
|
-
|
|
26839
|
-
|
|
26840
|
-
|
|
26841
|
-
|
|
26842
|
-
|
|
26843
|
-
|
|
26844
|
-
|
|
26845
|
-
|
|
26846
|
-
|
|
26847
|
-
|
|
26848
|
-
|
|
26849
|
-
|
|
26850
|
-
|
|
26851
|
-
|
|
26852
|
-
|
|
26853
|
-
|
|
26854
|
-
|
|
26855
|
-
|
|
26856
|
-
|
|
26857
|
-
|
|
26858
|
-
|
|
26859
|
-
|
|
26860
|
-
|
|
26861
|
-
|
|
26862
|
-
|
|
26863
|
-
|
|
26864
|
-
|
|
26865
|
-
}
|
|
26866
|
-
|
|
26867
|
-
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
|
|
26876
|
-
|
|
26877
|
-
|
|
26878
|
-
|
|
26879
|
-
|
|
26880
|
-
|
|
26881
|
-
}
|
|
26882
|
-
|
|
26883
|
-
|
|
26884
|
-
|
|
26885
|
-
}
|
|
26886
|
-
|
|
26887
|
-
var skillSetApplyInputSchema = external_exports.object({
|
|
26888
|
-
agentId: external_exports.string().min(1),
|
|
26889
|
-
setIds: external_exports.array(external_exports.string().min(1)).min(1).max(50)
|
|
26890
|
-
});
|
|
26891
|
-
var skillSetSkipReasonSchema = external_exports.enum([
|
|
26892
|
-
"source-not-connected",
|
|
26893
|
-
"source-unreadable",
|
|
26894
|
-
"not-in-source"
|
|
26895
|
-
]);
|
|
26896
|
-
var skillSetApplyResultSchema = external_exports.object({
|
|
26897
|
-
installed: external_exports.array(skillRefSchema),
|
|
26898
|
-
added: external_exports.number().int().nonnegative(),
|
|
26899
|
-
skipped: external_exports.array(
|
|
26900
|
-
skillSetEntrySchema.extend({ reason: skillSetSkipReasonSchema })
|
|
26901
|
-
)
|
|
26902
|
-
});
|
|
26903
|
-
var MAX_SKILL_BATCH_ENTRIES = 500;
|
|
26904
|
-
var skillApplyBatchInputSchema = external_exports.object({
|
|
26905
|
-
agentId: external_exports.string().min(1),
|
|
26906
|
-
install: external_exports.array(
|
|
26907
|
-
external_exports.object({
|
|
26908
|
-
source: external_exports.string().url(),
|
|
26909
|
-
name: external_exports.string().min(1),
|
|
26910
|
-
version: external_exports.string().min(1),
|
|
26911
|
-
contentHash: external_exports.string().optional()
|
|
26912
|
-
})
|
|
26913
|
-
).max(MAX_SKILL_BATCH_ENTRIES).default([]),
|
|
26914
|
-
uninstall: external_exports.array(
|
|
26915
|
-
external_exports.object({
|
|
26916
|
-
source: external_exports.string().url(),
|
|
26917
|
-
name: external_exports.string().min(1)
|
|
26918
|
-
})
|
|
26919
|
-
).max(MAX_SKILL_BATCH_ENTRIES).default([])
|
|
26920
|
-
}).refine(
|
|
26921
|
-
(v2) => v2.install.length + v2.uninstall.length <= MAX_SKILL_BATCH_ENTRIES,
|
|
26922
|
-
{
|
|
26923
|
-
message: `one batch carries at most ${MAX_SKILL_BATCH_ENTRIES} skills, install and uninstall combined`
|
|
26762
|
+
// ../api-server-api/src/modules/connections/providers.ts
|
|
26763
|
+
var DEFAULT_ENV_PLACEHOLDER = "dummy-placeholder";
|
|
26764
|
+
var IBM_LITELLM_HOST = "ete-litellm.ai-models.vpc.res.ibm.com";
|
|
26765
|
+
var IBM_LITELLM_BASE_URL = `https://${IBM_LITELLM_HOST}`;
|
|
26766
|
+
function ibmLitellmEnvMappings() {
|
|
26767
|
+
return [
|
|
26768
|
+
{ envName: "ANTHROPIC_AUTH_TOKEN", placeholder: "sk-dummy" },
|
|
26769
|
+
{ envName: "ANTHROPIC_BASE_URL", placeholder: IBM_LITELLM_BASE_URL },
|
|
26770
|
+
{ envName: "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS", placeholder: "1" },
|
|
26771
|
+
{ envName: "OPENAI_PROXY_URL", placeholder: IBM_LITELLM_BASE_URL },
|
|
26772
|
+
{ envName: "OPENAI_PROXY_MODEL", placeholder: "aws/claude-opus-4-8" },
|
|
26773
|
+
{ envName: "OPENAI_PROXY_CONTEXT_WINDOW", placeholder: "200000" },
|
|
26774
|
+
{ envName: "OPENAI_PROXY_MAX_TOKENS", placeholder: "8192" },
|
|
26775
|
+
{ envName: "OPENAI_API_KEY", placeholder: DEFAULT_ENV_PLACEHOLDER },
|
|
26776
|
+
{ envName: "OPENAI_BASE_URL", placeholder: IBM_LITELLM_BASE_URL },
|
|
26777
|
+
{ envName: "OPENAI_MODEL", placeholder: "gpt-5.5" },
|
|
26778
|
+
{ envName: "BOB_GATEWAY_URL", placeholder: IBM_LITELLM_BASE_URL },
|
|
26779
|
+
{ envName: "BOBSHELL_API_KEY", placeholder: DEFAULT_ENV_PLACEHOLDER }
|
|
26780
|
+
];
|
|
26781
|
+
}
|
|
26782
|
+
function openaiEnvMappings() {
|
|
26783
|
+
return [
|
|
26784
|
+
{ envName: "OPENAI_API_KEY", placeholder: DEFAULT_ENV_PLACEHOLDER },
|
|
26785
|
+
{ envName: "OPENAI_BASE_URL", placeholder: "https://api.openai.com/v1" }
|
|
26786
|
+
];
|
|
26787
|
+
}
|
|
26788
|
+
var BOB_HOST = "api.us-east.bob.ibm.com";
|
|
26789
|
+
var BOB_BASE_URL = `https://${BOB_HOST}`;
|
|
26790
|
+
var BOB_PLACEHOLDER = "dummy-placeholder";
|
|
26791
|
+
function bobEnvMappings(pins = {}) {
|
|
26792
|
+
const out = [
|
|
26793
|
+
{ envName: "BOBSHELL_API_KEY", placeholder: BOB_PLACEHOLDER },
|
|
26794
|
+
{ envName: "BOB_DEFAULT_GATEWAY_URL", placeholder: BOB_BASE_URL }
|
|
26795
|
+
];
|
|
26796
|
+
const push = (envName, value) => {
|
|
26797
|
+
const trimmed = value?.trim();
|
|
26798
|
+
if (trimmed) out.push({ envName, placeholder: trimmed });
|
|
26799
|
+
};
|
|
26800
|
+
push("BOB_SHELL_MODEL", pins.model);
|
|
26801
|
+
push("BOB_INSTANCE_ID", pins.agentId);
|
|
26802
|
+
push("BOB_TEAM_ID", pins.teamId);
|
|
26803
|
+
push("BOB_MAX_COINS", pins.maxCost);
|
|
26804
|
+
push("BOB_CHAT_MODE", pins.chatMode);
|
|
26805
|
+
return out;
|
|
26806
|
+
}
|
|
26807
|
+
var PROVIDERS = {
|
|
26808
|
+
anthropic: {
|
|
26809
|
+
id: "anthropic",
|
|
26810
|
+
displayName: "Anthropic",
|
|
26811
|
+
hostPattern: "api.anthropic.com",
|
|
26812
|
+
modes: [
|
|
26813
|
+
{
|
|
26814
|
+
key: "oauth",
|
|
26815
|
+
label: "OAuth Token",
|
|
26816
|
+
templateId: "anthropic-oauth",
|
|
26817
|
+
tokenPrefix: "sk-ant-oat",
|
|
26818
|
+
defaultEnvMappings: [
|
|
26819
|
+
{
|
|
26820
|
+
envName: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
26821
|
+
placeholder: DEFAULT_ENV_PLACEHOLDER
|
|
26822
|
+
}
|
|
26823
|
+
]
|
|
26824
|
+
},
|
|
26825
|
+
{
|
|
26826
|
+
key: "api-key",
|
|
26827
|
+
label: "API Key",
|
|
26828
|
+
templateId: "anthropic",
|
|
26829
|
+
tokenPrefix: "sk-ant-api",
|
|
26830
|
+
isDefault: true,
|
|
26831
|
+
defaultEnvMappings: [
|
|
26832
|
+
{
|
|
26833
|
+
envName: "ANTHROPIC_API_KEY",
|
|
26834
|
+
placeholder: DEFAULT_ENV_PLACEHOLDER
|
|
26835
|
+
}
|
|
26836
|
+
],
|
|
26837
|
+
injection: { headerName: "x-api-key", valueFormat: "{value}" }
|
|
26838
|
+
}
|
|
26839
|
+
]
|
|
26840
|
+
},
|
|
26841
|
+
"ibm-litellm": {
|
|
26842
|
+
id: "ibm-litellm",
|
|
26843
|
+
displayName: "IBM LiteLLM ETE Proxy",
|
|
26844
|
+
hostPattern: IBM_LITELLM_HOST,
|
|
26845
|
+
modes: [
|
|
26846
|
+
{
|
|
26847
|
+
key: "api-key",
|
|
26848
|
+
label: "API Token",
|
|
26849
|
+
templateId: "ibm-litellm",
|
|
26850
|
+
defaultEnvMappings: ibmLitellmEnvMappings()
|
|
26851
|
+
}
|
|
26852
|
+
]
|
|
26853
|
+
},
|
|
26854
|
+
openai: {
|
|
26855
|
+
id: "openai",
|
|
26856
|
+
displayName: "OpenAI",
|
|
26857
|
+
hostPattern: "api.openai.com",
|
|
26858
|
+
pathPattern: "/v1/*",
|
|
26859
|
+
modes: [
|
|
26860
|
+
{
|
|
26861
|
+
key: "api-key",
|
|
26862
|
+
label: "API Key",
|
|
26863
|
+
templateId: "openai",
|
|
26864
|
+
defaultEnvMappings: openaiEnvMappings()
|
|
26865
|
+
}
|
|
26866
|
+
]
|
|
26867
|
+
},
|
|
26868
|
+
bob: {
|
|
26869
|
+
id: "bob",
|
|
26870
|
+
displayName: "Bob Shell",
|
|
26871
|
+
hostPattern: BOB_HOST,
|
|
26872
|
+
modes: [
|
|
26873
|
+
{
|
|
26874
|
+
key: "api-key",
|
|
26875
|
+
label: "API Key",
|
|
26876
|
+
templateId: "bob",
|
|
26877
|
+
defaultEnvMappings: bobEnvMappings(),
|
|
26878
|
+
injection: {
|
|
26879
|
+
headerName: "Authorization",
|
|
26880
|
+
valueFormat: "Apikey {value}"
|
|
26881
|
+
},
|
|
26882
|
+
extraInjections: [
|
|
26883
|
+
{ headerName: "X-Bobshell-Internal", queryParamName: "key" }
|
|
26884
|
+
]
|
|
26885
|
+
}
|
|
26886
|
+
]
|
|
26924
26887
|
}
|
|
26888
|
+
};
|
|
26889
|
+
var PROVIDER_PRESET_TYPES = Object.keys(
|
|
26890
|
+
PROVIDERS
|
|
26925
26891
|
);
|
|
26926
|
-
|
|
26927
|
-
|
|
26928
|
-
}
|
|
26929
|
-
var
|
|
26930
|
-
|
|
26931
|
-
|
|
26932
|
-
|
|
26933
|
-
|
|
26934
|
-
name: external_exports.string().min(1)
|
|
26935
|
-
});
|
|
26936
|
-
var skillReadLocalInputSchema = external_exports.object({
|
|
26937
|
-
agentId: external_exports.string().min(1),
|
|
26938
|
-
name: external_exports.string().min(1)
|
|
26939
|
-
});
|
|
26940
|
-
var skillLocalFilesSchema = external_exports.object({
|
|
26941
|
-
dir: external_exports.string(),
|
|
26942
|
-
files: external_exports.array(
|
|
26943
|
-
external_exports.object({
|
|
26944
|
-
relPath: external_exports.string(),
|
|
26945
|
-
content: external_exports.string(),
|
|
26946
|
-
base64: external_exports.literal(true).optional()
|
|
26947
|
-
})
|
|
26892
|
+
function isProviderPresetType(type) {
|
|
26893
|
+
return type in PROVIDERS;
|
|
26894
|
+
}
|
|
26895
|
+
var TEMPLATE_TO_PROVIDER = new Map(
|
|
26896
|
+
PROVIDER_PRESET_TYPES.flatMap(
|
|
26897
|
+
(type) => PROVIDERS[type].modes.map(
|
|
26898
|
+
(mode) => [mode.templateId, type]
|
|
26899
|
+
)
|
|
26948
26900
|
)
|
|
26949
|
-
});
|
|
26950
|
-
var skillPublishInputSchema = external_exports.object({
|
|
26951
|
-
agentId: external_exports.string().min(1),
|
|
26952
|
-
sourceId: external_exports.string().min(1),
|
|
26953
|
-
name: external_exports.string().min(1),
|
|
26954
|
-
title: external_exports.string().optional(),
|
|
26955
|
-
body: external_exports.string().optional()
|
|
26956
|
-
});
|
|
26957
|
-
var skillCreateLocalInputSchema = external_exports.object({
|
|
26958
|
-
agentId: external_exports.string().min(1),
|
|
26959
|
-
skills: external_exports.array(
|
|
26960
|
-
external_exports.object({
|
|
26961
|
-
name: external_exports.string().min(1).max(128),
|
|
26962
|
-
content: external_exports.string().max(2 * 1024 * 1024)
|
|
26963
|
-
})
|
|
26964
|
-
).min(1).max(50)
|
|
26965
|
-
}).refine(
|
|
26966
|
-
(v2) => v2.skills.reduce((n, s) => n + s.content.length, 0) <= 5 * 1024 * 1024,
|
|
26967
|
-
"batch exceeds 5 MB"
|
|
26968
26901
|
);
|
|
26969
|
-
|
|
26970
|
-
|
|
26971
|
-
|
|
26972
|
-
|
|
26973
|
-
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
|
|
26977
|
-
|
|
26978
|
-
|
|
26979
|
-
|
|
26980
|
-
|
|
26981
|
-
|
|
26982
|
-
});
|
|
26983
|
-
var envVarConfigMapSchema = external_exports.object({
|
|
26984
|
-
name: external_exports.string(),
|
|
26985
|
-
value: external_exports.string()
|
|
26986
|
-
});
|
|
26987
|
-
var skillSourceSeedSchema = external_exports.object({
|
|
26988
|
-
name: external_exports.string(),
|
|
26989
|
-
gitUrl: external_exports.string(),
|
|
26990
|
-
path: skillSourcePathSchema.optional()
|
|
26991
|
-
});
|
|
26992
|
-
var templateCategorySchema = external_exports.enum(["harness", "preconfigured"]).default("harness");
|
|
26993
|
-
var harnessFamilySchema = external_exports.enum([
|
|
26994
|
-
"claude-code",
|
|
26995
|
-
"codex",
|
|
26996
|
-
"pi",
|
|
26997
|
-
"bob"
|
|
26998
|
-
]);
|
|
26999
|
-
var templateSpecSchema = external_exports.object({
|
|
27000
|
-
version: external_exports.string(),
|
|
27001
|
-
image: external_exports.string(),
|
|
27002
|
-
name: external_exports.string().optional(),
|
|
27003
|
-
description: external_exports.string().optional(),
|
|
27004
|
-
category: templateCategorySchema,
|
|
27005
|
-
harness: harnessFamilySchema.optional(),
|
|
27006
|
-
tags: external_exports.array(external_exports.string()).optional(),
|
|
27007
|
-
docsUrl: external_exports.string().optional(),
|
|
27008
|
-
releaseNotesUrl: external_exports.string().optional(),
|
|
27009
|
-
setupNote: external_exports.object({ title: external_exports.string(), body: external_exports.string() }).optional(),
|
|
27010
|
-
experimental: external_exports.boolean().optional(),
|
|
27011
|
-
mounts: external_exports.array(mountSchema).optional(),
|
|
27012
|
-
init: external_exports.string().optional(),
|
|
27013
|
-
env: external_exports.array(envVarConfigMapSchema).optional(),
|
|
27014
|
-
resources: resourcesSchema.optional(),
|
|
27015
|
-
imagePullPolicy: external_exports.string().optional(),
|
|
27016
|
-
imagePullSecretRef: external_exports.string().optional(),
|
|
27017
|
-
hibernationTimeout: external_exports.string().optional(),
|
|
27018
|
-
storageSize: external_exports.string().optional(),
|
|
27019
|
-
storageClass: external_exports.string().optional(),
|
|
27020
|
-
backend: external_exports.object({
|
|
27021
|
-
type: external_exports.enum(["container", "vm"]),
|
|
27022
|
-
vm: external_exports.object({}).passthrough().optional()
|
|
27023
|
-
}).optional(),
|
|
27024
|
-
runtimeClassName: external_exports.string().optional(),
|
|
27025
|
-
nodeSelector: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
27026
|
-
skillSources: external_exports.array(skillSourceSeedSchema).optional()
|
|
27027
|
-
}).passthrough();
|
|
27028
|
-
|
|
27029
|
-
// ../api-server-api/src/modules/repos/schemas.ts
|
|
27030
|
-
var repoSchema = external_exports.object({
|
|
27031
|
-
id: external_exports.string().min(1),
|
|
27032
|
-
name: external_exports.string().min(1),
|
|
27033
|
-
url: external_exports.url(),
|
|
27034
|
-
ref: external_exports.string().min(1).optional(),
|
|
27035
|
-
description: external_exports.string().optional(),
|
|
27036
|
-
compatibleTemplates: external_exports.array(external_exports.string()).default([])
|
|
27037
|
-
});
|
|
27038
|
-
|
|
27039
|
-
// ../api-server-api/src/modules/invocations/schemas.ts
|
|
27040
|
-
var DEFAULT_INVOCATION_TTL_MS = 60 * 60 * 1e3;
|
|
27041
|
-
var MIN_INVOCATION_TTL_MS = 60 * 1e3;
|
|
27042
|
-
var MAX_INVOCATION_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
27043
|
-
var spawnInvocationRequestSchema = external_exports.object({
|
|
27044
|
-
image: external_exports.string().min(1).optional(),
|
|
27045
|
-
templateId: external_exports.string().min(1).optional(),
|
|
27046
|
-
connections: external_exports.array(external_exports.string().min(1)).optional(),
|
|
27047
|
-
prompt: external_exports.string().min(1),
|
|
27048
|
-
schema: external_exports.unknown(),
|
|
27049
|
-
ttlMs: external_exports.number().int().min(MIN_INVOCATION_TTL_MS).max(MAX_INVOCATION_TTL_MS).optional(),
|
|
27050
|
-
memory: external_exports.string().regex(/^\d+(Mi|Gi)$/, "memory must look like '512Mi' or '4Gi'").optional(),
|
|
27051
|
-
cpu: external_exports.string().regex(/^\d+(\.\d+)?m?$/, "cpu must look like '2', '0.5' or '500m'").optional(),
|
|
27052
|
-
experimentSpanId: external_exports.string().min(1).max(300).optional()
|
|
27053
|
-
}).refine((d2) => d2.image !== void 0 || d2.templateId !== void 0, {
|
|
27054
|
-
message: "either image or templateId is required"
|
|
27055
|
-
});
|
|
27056
|
-
var spawnInvocationResponseSchema = external_exports.object({
|
|
27057
|
-
id: external_exports.string().min(1)
|
|
27058
|
-
});
|
|
27059
|
-
var invocationViewSchema = external_exports.object({
|
|
27060
|
-
status: external_exports.enum(["running", "done", "failed"]),
|
|
27061
|
-
result: external_exports.unknown(),
|
|
27062
|
-
errorReason: external_exports.string().optional()
|
|
27063
|
-
});
|
|
26902
|
+
var PROVIDER_TEMPLATE_IDS = new Set(
|
|
26903
|
+
TEMPLATE_TO_PROVIDER.keys()
|
|
26904
|
+
);
|
|
26905
|
+
function providerTypeForTemplateId(templateId) {
|
|
26906
|
+
return TEMPLATE_TO_PROVIDER.get(templateId) ?? null;
|
|
26907
|
+
}
|
|
26908
|
+
function templateIdForProvider(type, value) {
|
|
26909
|
+
const modes = PROVIDERS[type].modes;
|
|
26910
|
+
const matched = modes.find(
|
|
26911
|
+
(mode) => mode.tokenPrefix !== void 0 && value.startsWith(mode.tokenPrefix)
|
|
26912
|
+
);
|
|
26913
|
+
return (matched ?? modes.find((mode) => mode.isDefault) ?? modes[0]).templateId;
|
|
26914
|
+
}
|
|
27064
26915
|
|
|
27065
26916
|
// ../agent-runtime-api/src/modules/files/schemas.ts
|
|
27066
26917
|
var pathSchema = external_exports.string().min(1);
|
|
@@ -27117,6 +26968,7 @@ var podSessionSchema = external_exports.object({
|
|
|
27117
26968
|
title: external_exports.string().nullable(),
|
|
27118
26969
|
scheduleId: external_exports.string().nullable(),
|
|
27119
26970
|
experimentId: external_exports.string().nullable(),
|
|
26971
|
+
initialization: external_exports.boolean().optional(),
|
|
27120
26972
|
threadTs: external_exports.string().nullable(),
|
|
27121
26973
|
seenAt: external_exports.string().nullable(),
|
|
27122
26974
|
runStartedAt: external_exports.string().nullable(),
|
|
@@ -27142,14 +26994,14 @@ var sessionDirectoryReportSchema = external_exports.object({
|
|
|
27142
26994
|
});
|
|
27143
26995
|
|
|
27144
26996
|
// ../agent-runtime-api/src/modules/skills/schemas.ts
|
|
27145
|
-
var
|
|
26997
|
+
var skillInstallInputSchema = external_exports.object({
|
|
27146
26998
|
sourceUrl: external_exports.string().min(1),
|
|
27147
26999
|
name: external_exports.string().min(1),
|
|
27148
27000
|
version: external_exports.string().min(1),
|
|
27149
27001
|
skillPaths: external_exports.array(external_exports.string().min(1)).min(1),
|
|
27150
27002
|
path: external_exports.string().optional()
|
|
27151
27003
|
});
|
|
27152
|
-
var
|
|
27004
|
+
var skillUninstallInputSchema = external_exports.object({
|
|
27153
27005
|
name: external_exports.string().min(1),
|
|
27154
27006
|
skillPaths: external_exports.array(external_exports.string().min(1)).min(1)
|
|
27155
27007
|
});
|
|
@@ -27157,7 +27009,7 @@ var skillScanInputSchema = external_exports.object({
|
|
|
27157
27009
|
source: external_exports.string().min(1),
|
|
27158
27010
|
path: external_exports.string().optional()
|
|
27159
27011
|
});
|
|
27160
|
-
var
|
|
27012
|
+
var skillPublishInputSchema = external_exports.object({
|
|
27161
27013
|
name: external_exports.string().min(1),
|
|
27162
27014
|
owner: external_exports.string().min(1),
|
|
27163
27015
|
repo: external_exports.string().min(1),
|
|
@@ -27165,10 +27017,10 @@ var skillPublishInputSchema2 = external_exports.object({
|
|
|
27165
27017
|
body: external_exports.string(),
|
|
27166
27018
|
path: external_exports.string().optional()
|
|
27167
27019
|
});
|
|
27168
|
-
var
|
|
27020
|
+
var skillListLocalInputSchema = external_exports.object({
|
|
27169
27021
|
hashNames: external_exports.array(external_exports.string()).optional()
|
|
27170
27022
|
});
|
|
27171
|
-
var
|
|
27023
|
+
var skillReadLocalInputSchema = external_exports.object({
|
|
27172
27024
|
name: external_exports.string().min(1)
|
|
27173
27025
|
});
|
|
27174
27026
|
var skillReadPullRequestInputSchema = external_exports.object({
|
|
@@ -27181,7 +27033,7 @@ var skillReadSkillFileInputSchema = external_exports.object({
|
|
|
27181
27033
|
version: external_exports.string().min(1),
|
|
27182
27034
|
dir: external_exports.string().min(1)
|
|
27183
27035
|
});
|
|
27184
|
-
var
|
|
27036
|
+
var skillDeleteLocalInputSchema = external_exports.object({
|
|
27185
27037
|
name: external_exports.string().min(1)
|
|
27186
27038
|
});
|
|
27187
27039
|
var skillWriteLocalInputSchema = external_exports.object({
|
|
@@ -27196,6 +27048,97 @@ var skillWriteLocalInputSchema = external_exports.object({
|
|
|
27196
27048
|
// ../agent-runtime-api/src/modules/skills/source-roots.ts
|
|
27197
27049
|
var STAGED_SKILLS_DIR = "/usr/local/share/dam-skills";
|
|
27198
27050
|
|
|
27051
|
+
// ../agent-runtime-api/src/modules/skills/git-url.ts
|
|
27052
|
+
var BROWSE_MARKERS = ["tree", "blob"];
|
|
27053
|
+
var DEFAULT_PORTS = ["80", "443"];
|
|
27054
|
+
var GITHUB_HOST = "github.com";
|
|
27055
|
+
function normalizeGitUrl(input) {
|
|
27056
|
+
const trimmed = input.trim();
|
|
27057
|
+
if (trimmed.length === 0) return null;
|
|
27058
|
+
const url2 = parseUrl(
|
|
27059
|
+
/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`
|
|
27060
|
+
);
|
|
27061
|
+
if (!url2) return null;
|
|
27062
|
+
if (url2.protocol !== "https:" && url2.protocol !== "http:") return null;
|
|
27063
|
+
url2.protocol = "https:";
|
|
27064
|
+
url2.search = "";
|
|
27065
|
+
url2.hash = "";
|
|
27066
|
+
url2.username = "";
|
|
27067
|
+
url2.password = "";
|
|
27068
|
+
if (DEFAULT_PORTS.includes(url2.port)) url2.port = "";
|
|
27069
|
+
if (url2.hostname === `www.${GITHUB_HOST}`) url2.hostname = GITHUB_HOST;
|
|
27070
|
+
if (url2.hostname.length === 0) return null;
|
|
27071
|
+
const isGithub = url2.hostname === GITHUB_HOST;
|
|
27072
|
+
const segments = url2.pathname.split("/").filter((s) => s.length > 0);
|
|
27073
|
+
const browsed = splitBrowseUrl(segments);
|
|
27074
|
+
const repoSegments = stripRepoSuffix(
|
|
27075
|
+
isGithub ? browsed.repoSegments.slice(0, 2).map((s) => s.toLowerCase()) : browsed.repoSegments
|
|
27076
|
+
);
|
|
27077
|
+
if (repoSegments.length < 2) return null;
|
|
27078
|
+
url2.pathname = `/${repoSegments.join("/")}`;
|
|
27079
|
+
const path2 = browsed.path && decodePath(browsed.path);
|
|
27080
|
+
return {
|
|
27081
|
+
gitUrl: url2.toString().replace(/\/$/, ""),
|
|
27082
|
+
...path2 ? { path: path2 } : {},
|
|
27083
|
+
...browsed.ref !== void 0 ? { ref: browsed.ref } : {}
|
|
27084
|
+
};
|
|
27085
|
+
}
|
|
27086
|
+
function canonicalSourceLocation(gitUrl, path2) {
|
|
27087
|
+
const normalized = normalizeGitUrl(gitUrl);
|
|
27088
|
+
if (!normalized) return null;
|
|
27089
|
+
const resolved = path2?.trim() || normalized.path;
|
|
27090
|
+
return {
|
|
27091
|
+
gitUrl: normalized.gitUrl,
|
|
27092
|
+
...resolved ? { path: resolved } : {}
|
|
27093
|
+
};
|
|
27094
|
+
}
|
|
27095
|
+
function parseUrl(candidate) {
|
|
27096
|
+
try {
|
|
27097
|
+
return new URL(candidate);
|
|
27098
|
+
} catch {
|
|
27099
|
+
return null;
|
|
27100
|
+
}
|
|
27101
|
+
}
|
|
27102
|
+
function decodePath(path2) {
|
|
27103
|
+
const decoded = [];
|
|
27104
|
+
for (const segment of path2.split("/")) {
|
|
27105
|
+
let value;
|
|
27106
|
+
try {
|
|
27107
|
+
value = decodeURIComponent(segment);
|
|
27108
|
+
} catch {
|
|
27109
|
+
return null;
|
|
27110
|
+
}
|
|
27111
|
+
if (value === "" || value === "." || value === "..") return null;
|
|
27112
|
+
if (value.includes("/") || value.includes("\\") || value.includes("\0")) {
|
|
27113
|
+
return null;
|
|
27114
|
+
}
|
|
27115
|
+
decoded.push(value);
|
|
27116
|
+
}
|
|
27117
|
+
return decoded.join("/");
|
|
27118
|
+
}
|
|
27119
|
+
function splitBrowseUrl(segments) {
|
|
27120
|
+
const marker = segments.findIndex(
|
|
27121
|
+
(s, i) => i >= 2 && BROWSE_MARKERS.includes(s)
|
|
27122
|
+
);
|
|
27123
|
+
if (marker === -1 || marker + 1 >= segments.length) {
|
|
27124
|
+
return { repoSegments: segments };
|
|
27125
|
+
}
|
|
27126
|
+
const before = segments.slice(0, marker);
|
|
27127
|
+
const rest = segments.slice(marker + 2);
|
|
27128
|
+
const dir = segments[marker] === "blob" ? rest.slice(0, -1) : rest;
|
|
27129
|
+
return {
|
|
27130
|
+
repoSegments: before[before.length - 1] === "-" ? before.slice(0, -1) : before,
|
|
27131
|
+
...dir.length > 0 ? { path: dir.join("/") } : {},
|
|
27132
|
+
ref: segments[marker + 1]
|
|
27133
|
+
};
|
|
27134
|
+
}
|
|
27135
|
+
function stripRepoSuffix(segments) {
|
|
27136
|
+
if (segments.length === 0) return segments;
|
|
27137
|
+
const last = segments[segments.length - 1].replace(/\.git$/, "");
|
|
27138
|
+
if (last.length === 0) return segments.slice(0, -1);
|
|
27139
|
+
return [...segments.slice(0, -1), last];
|
|
27140
|
+
}
|
|
27141
|
+
|
|
27199
27142
|
// ../agent-runtime-api/src/modules/workspace/paths.ts
|
|
27200
27143
|
var AGENT_HOME_DIR = "/home/agent";
|
|
27201
27144
|
var AGENT_WORK_DIR = `${AGENT_HOME_DIR}/work`;
|
|
@@ -27238,6 +27181,7 @@ var eventKind = external_exports.enum([
|
|
|
27238
27181
|
"workspace-seed",
|
|
27239
27182
|
"workspace-command",
|
|
27240
27183
|
"experiment-execute",
|
|
27184
|
+
"initialization",
|
|
27241
27185
|
"harness-config"
|
|
27242
27186
|
]);
|
|
27243
27187
|
var mergeMode = external_exports.enum([
|
|
@@ -27259,10 +27203,20 @@ var egressAllowContribution = external_exports.object({
|
|
|
27259
27203
|
port: egressPort,
|
|
27260
27204
|
pathPattern: external_exports.string().optional()
|
|
27261
27205
|
});
|
|
27206
|
+
var anchoredPathSegments = /^\/(?:[A-Za-z0-9._~-]+\/)*$/;
|
|
27207
|
+
var anchoredPath = external_exports.string().regex(anchoredPathSegments).refine(
|
|
27208
|
+
(p2) => p2.split("/").every((seg) => seg !== "." && seg !== ".."),
|
|
27209
|
+
"path segments must not be relative"
|
|
27210
|
+
);
|
|
27211
|
+
var pathRewrite = external_exports.object({
|
|
27212
|
+
prefix: anchoredPath,
|
|
27213
|
+
replacement: anchoredPath
|
|
27214
|
+
});
|
|
27262
27215
|
var egressInjectContribution = external_exports.object({
|
|
27263
27216
|
kind: external_exports.literal("egress-inject"),
|
|
27264
27217
|
host: external_exports.string().min(1),
|
|
27265
27218
|
pathPattern: external_exports.string().optional(),
|
|
27219
|
+
pathRewrites: external_exports.array(pathRewrite).min(1).max(8).optional(),
|
|
27266
27220
|
headerName: external_exports.string().min(1),
|
|
27267
27221
|
valueFormat: external_exports.string().min(1),
|
|
27268
27222
|
encoding: external_exports.literal("basic-x-access-token").optional(),
|
|
@@ -27304,7 +27258,10 @@ var triggerEventPayload = external_exports.object({
|
|
|
27304
27258
|
scheduleId: external_exports.string().min(1),
|
|
27305
27259
|
task: external_exports.string().min(1),
|
|
27306
27260
|
sessionMode: external_exports.enum(["continuous", "fresh"]).optional(),
|
|
27307
|
-
mcpServers: external_exports.array(external_exports.unknown()).optional()
|
|
27261
|
+
mcpServers: external_exports.array(external_exports.unknown()).optional(),
|
|
27262
|
+
precheck: external_exports.string().min(1).optional(),
|
|
27263
|
+
fireAt: external_exports.string().datetime({ offset: true }).optional(),
|
|
27264
|
+
lastRunAt: external_exports.string().datetime({ offset: true }).optional()
|
|
27308
27265
|
});
|
|
27309
27266
|
var triggerEvent = external_exports.object({
|
|
27310
27267
|
id: external_exports.string().min(1),
|
|
@@ -27313,6 +27270,12 @@ var triggerEvent = external_exports.object({
|
|
|
27313
27270
|
expiresAt: external_exports.string().datetime({ offset: true }),
|
|
27314
27271
|
payload: triggerEventPayload
|
|
27315
27272
|
});
|
|
27273
|
+
var eventOutcome = external_exports.enum(["ok", "declined", "failed"]);
|
|
27274
|
+
var eventReportInput = external_exports.object({
|
|
27275
|
+
eventId: external_exports.string().min(1),
|
|
27276
|
+
outcome: eventOutcome,
|
|
27277
|
+
detail: external_exports.string().max(2e3).optional()
|
|
27278
|
+
});
|
|
27316
27279
|
var scheduleResetEventPayload = external_exports.object({
|
|
27317
27280
|
scheduleId: external_exports.string().min(1)
|
|
27318
27281
|
});
|
|
@@ -27325,7 +27288,10 @@ var scheduleResetEvent = external_exports.object({
|
|
|
27325
27288
|
});
|
|
27326
27289
|
var workspaceSeedEventPayload = external_exports.object({
|
|
27327
27290
|
url: external_exports.string().min(1),
|
|
27328
|
-
ref: external_exports.string().min(1).optional()
|
|
27291
|
+
ref: external_exports.string().min(1).optional(),
|
|
27292
|
+
commit: external_exports.string().min(1).optional(),
|
|
27293
|
+
branch: external_exports.string().min(1).optional(),
|
|
27294
|
+
into: external_exports.enum(["work", "home"]).optional()
|
|
27329
27295
|
});
|
|
27330
27296
|
var workspaceSeedEvent = external_exports.object({
|
|
27331
27297
|
id: external_exports.string().min(1),
|
|
@@ -27355,118 +27321,447 @@ var experimentExecuteEvent = external_exports.object({
|
|
|
27355
27321
|
expiresAt: external_exports.string().datetime({ offset: true }),
|
|
27356
27322
|
payload: experimentExecuteEventPayload
|
|
27357
27323
|
});
|
|
27358
|
-
var
|
|
27359
|
-
|
|
27360
|
-
|
|
27361
|
-
|
|
27362
|
-
|
|
27324
|
+
var initializationEventPayload = external_exports.object({
|
|
27325
|
+
task: external_exports.string().min(1)
|
|
27326
|
+
});
|
|
27327
|
+
var initializationEvent = external_exports.object({
|
|
27328
|
+
id: external_exports.string().min(1),
|
|
27329
|
+
kind: external_exports.literal("initialization"),
|
|
27330
|
+
version: external_exports.number().int().nonnegative(),
|
|
27331
|
+
expiresAt: external_exports.string().datetime({ offset: true }),
|
|
27332
|
+
payload: initializationEventPayload
|
|
27333
|
+
});
|
|
27334
|
+
var harnessConfigEventPayload = external_exports.object({
|
|
27335
|
+
model: external_exports.string().min(1).optional(),
|
|
27336
|
+
mode: external_exports.string().min(1).optional(),
|
|
27337
|
+
configOptions: external_exports.record(external_exports.string().min(1), external_exports.string()).optional(),
|
|
27338
|
+
unset: external_exports.array(external_exports.string().min(1)).optional()
|
|
27339
|
+
});
|
|
27340
|
+
var harnessConfigEvent = external_exports.object({
|
|
27341
|
+
id: external_exports.string().min(1),
|
|
27342
|
+
kind: external_exports.literal("harness-config"),
|
|
27343
|
+
version: external_exports.number().int().nonnegative(),
|
|
27344
|
+
expiresAt: external_exports.string().datetime({ offset: true }),
|
|
27345
|
+
payload: harnessConfigEventPayload
|
|
27346
|
+
});
|
|
27347
|
+
var event = external_exports.discriminatedUnion("kind", [
|
|
27348
|
+
triggerEvent,
|
|
27349
|
+
scheduleResetEvent,
|
|
27350
|
+
workspaceSeedEvent,
|
|
27351
|
+
workspaceCommandEvent,
|
|
27352
|
+
experimentExecuteEvent,
|
|
27353
|
+
initializationEvent,
|
|
27354
|
+
harnessConfigEvent
|
|
27355
|
+
]);
|
|
27356
|
+
var harnessConfigChoice = external_exports.object({
|
|
27357
|
+
value: external_exports.string().min(1),
|
|
27358
|
+
name: external_exports.string().min(1),
|
|
27359
|
+
description: external_exports.string().optional()
|
|
27360
|
+
});
|
|
27361
|
+
var harnessConfigOptionGroup = external_exports.object({
|
|
27362
|
+
id: external_exports.string().min(1),
|
|
27363
|
+
name: external_exports.string().min(1),
|
|
27364
|
+
description: external_exports.string().optional(),
|
|
27365
|
+
category: external_exports.string().min(1),
|
|
27366
|
+
choices: external_exports.array(harnessConfigChoice)
|
|
27367
|
+
});
|
|
27368
|
+
var harnessConfigCatalog = external_exports.object({
|
|
27369
|
+
options: external_exports.array(harnessConfigOptionGroup),
|
|
27370
|
+
modelConstraints: external_exports.record(external_exports.string().min(1), external_exports.record(external_exports.string().min(1), external_exports.array(external_exports.string()))).optional()
|
|
27371
|
+
});
|
|
27372
|
+
var harnessConfigCurrent = external_exports.object({
|
|
27373
|
+
model: external_exports.string().nullable(),
|
|
27374
|
+
mode: external_exports.string().nullable(),
|
|
27375
|
+
configOptions: external_exports.record(external_exports.string().min(1), external_exports.string()),
|
|
27376
|
+
availableModels: external_exports.array(harnessConfigChoice).nullable().optional()
|
|
27377
|
+
});
|
|
27378
|
+
var capabilities = external_exports.object({
|
|
27379
|
+
contributions: external_exports.array(contributionKind),
|
|
27380
|
+
events: external_exports.array(eventKind),
|
|
27381
|
+
harnessConfig: external_exports.boolean().optional(),
|
|
27382
|
+
harnessConfigCatalog: harnessConfigCatalog.optional(),
|
|
27383
|
+
kbPublish: external_exports.number().int().optional(),
|
|
27384
|
+
liveUpdates: external_exports.boolean().optional()
|
|
27385
|
+
});
|
|
27386
|
+
var runtimeFeatureFlags = external_exports.looseObject({
|
|
27387
|
+
liveUpdates: external_exports.boolean().optional().catch(void 0)
|
|
27388
|
+
});
|
|
27389
|
+
var stateSlice = external_exports.object({
|
|
27390
|
+
contributions: external_exports.array(contribution),
|
|
27391
|
+
hash: external_exports.string().min(1)
|
|
27392
|
+
});
|
|
27393
|
+
var applyStateInput = external_exports.object({
|
|
27394
|
+
version: external_exports.number().int().positive(),
|
|
27395
|
+
state: stateSlice,
|
|
27396
|
+
events: external_exports.array(event)
|
|
27397
|
+
});
|
|
27398
|
+
var driverFailure = external_exports.object({
|
|
27399
|
+
kind: contributionKind,
|
|
27400
|
+
message: external_exports.string().min(1)
|
|
27401
|
+
});
|
|
27402
|
+
var applyStateResult = external_exports.discriminatedUnion("status", [
|
|
27403
|
+
external_exports.object({
|
|
27404
|
+
status: external_exports.literal("ok"),
|
|
27405
|
+
appliedVersion: external_exports.number().int().nonnegative(),
|
|
27406
|
+
appliedHash: external_exports.string().min(1).nullable(),
|
|
27407
|
+
failures: external_exports.array(driverFailure).default([]),
|
|
27408
|
+
settledEvents: external_exports.array(external_exports.string()).default([]),
|
|
27409
|
+
harnessConfigCurrent: harnessConfigCurrent.optional()
|
|
27410
|
+
}),
|
|
27411
|
+
external_exports.object({
|
|
27412
|
+
status: external_exports.literal("stale"),
|
|
27413
|
+
appliedVersion: external_exports.number().int().nonnegative(),
|
|
27414
|
+
settledEvents: external_exports.array(external_exports.string()).default([]),
|
|
27415
|
+
harnessConfigCurrent: harnessConfigCurrent.optional()
|
|
27416
|
+
})
|
|
27417
|
+
]);
|
|
27418
|
+
var helloInput = external_exports.object({
|
|
27419
|
+
lastAppliedVersion: external_exports.number().int().nonnegative().optional(),
|
|
27420
|
+
lastAppliedHash: external_exports.string().optional(),
|
|
27421
|
+
protocolVersion: external_exports.literal("v1"),
|
|
27422
|
+
agentRuntimeVersion: external_exports.string(),
|
|
27423
|
+
capabilities,
|
|
27424
|
+
harnessConfigCurrent: harnessConfigCurrent.optional()
|
|
27425
|
+
});
|
|
27426
|
+
var helloResult = external_exports.object({
|
|
27427
|
+
version: external_exports.number().int().positive().optional(),
|
|
27428
|
+
state: stateSlice.optional(),
|
|
27429
|
+
events: external_exports.array(event)
|
|
27430
|
+
});
|
|
27431
|
+
|
|
27432
|
+
// ../agent-runtime-api/src/modules/kb-snapshot/caps.ts
|
|
27433
|
+
var PER_FILE_MAX_BYTES = 2 * 1024 * 1024;
|
|
27434
|
+
var TOTAL_MAX_BYTES = 200 * 1024 * 1024;
|
|
27435
|
+
var kbPublishCapsSchema = external_exports.object({
|
|
27436
|
+
perFileMaxBytes: external_exports.number().int().positive(),
|
|
27437
|
+
totalMaxBytes: external_exports.number().int().positive(),
|
|
27438
|
+
maxFiles: external_exports.number().int().positive(),
|
|
27439
|
+
maxWalkDepth: external_exports.number().int().positive()
|
|
27440
|
+
});
|
|
27441
|
+
|
|
27442
|
+
// ../agent-runtime-api/src/modules/kb-publish/schemas.ts
|
|
27443
|
+
var kbPublishSyncInputSchema = external_exports.object({
|
|
27444
|
+
roots: external_exports.array(external_exports.string().min(1)).max(16).nullable(),
|
|
27445
|
+
caps: kbPublishCapsSchema,
|
|
27446
|
+
flush: external_exports.boolean()
|
|
27447
|
+
});
|
|
27448
|
+
|
|
27449
|
+
// ../api-server-api/src/modules/skills/schemas.ts
|
|
27450
|
+
var skillSourcePathSchema = external_exports.string().transform((p2) => p2.trim().replace(/^\/+|\/+$/g, "")).refine((p2) => !p2.split("/").includes(".."), "path must not contain '..'");
|
|
27451
|
+
var skillSourceSchema = external_exports.object({
|
|
27452
|
+
id: external_exports.string(),
|
|
27453
|
+
name: external_exports.string(),
|
|
27454
|
+
gitUrl: external_exports.string(),
|
|
27455
|
+
path: external_exports.string().optional(),
|
|
27456
|
+
system: external_exports.boolean().optional(),
|
|
27457
|
+
fromTemplate: external_exports.object({ templateId: external_exports.string(), templateName: external_exports.string() }).optional(),
|
|
27458
|
+
canPublish: external_exports.boolean().optional()
|
|
27459
|
+
});
|
|
27460
|
+
var skillPublishResultSchema = external_exports.object({
|
|
27461
|
+
prUrl: external_exports.string().url(),
|
|
27462
|
+
branch: external_exports.string()
|
|
27463
|
+
});
|
|
27464
|
+
var skillSchema = external_exports.object({
|
|
27465
|
+
source: external_exports.string(),
|
|
27466
|
+
name: external_exports.string(),
|
|
27467
|
+
description: external_exports.string(),
|
|
27468
|
+
version: external_exports.string(),
|
|
27469
|
+
contentHash: external_exports.string(),
|
|
27470
|
+
dir: external_exports.string().optional()
|
|
27471
|
+
});
|
|
27472
|
+
var skillListResultSchema = external_exports.object({
|
|
27473
|
+
skills: external_exports.array(skillSchema),
|
|
27474
|
+
scannedAt: external_exports.string().datetime(),
|
|
27475
|
+
visibility: external_exports.enum(["public", "private"]).optional()
|
|
27476
|
+
});
|
|
27477
|
+
var scanFailureCodes = [
|
|
27478
|
+
"needs_github_connection",
|
|
27479
|
+
"needs_sandbox",
|
|
27480
|
+
"repo_unreachable",
|
|
27481
|
+
"agent_unreachable",
|
|
27482
|
+
"source_path_not_found",
|
|
27483
|
+
"source_path_empty",
|
|
27484
|
+
"other"
|
|
27485
|
+
];
|
|
27486
|
+
var scanFailureSchema = external_exports.object({
|
|
27487
|
+
code: external_exports.enum(scanFailureCodes),
|
|
27488
|
+
title: external_exports.string(),
|
|
27489
|
+
detail: external_exports.string()
|
|
27490
|
+
});
|
|
27491
|
+
var skillRefSchema = external_exports.object({
|
|
27492
|
+
source: external_exports.string(),
|
|
27493
|
+
name: external_exports.string(),
|
|
27494
|
+
version: external_exports.string(),
|
|
27495
|
+
contentHash: external_exports.string().optional(),
|
|
27496
|
+
path: external_exports.string().optional()
|
|
27497
|
+
});
|
|
27498
|
+
var localSkillSchema = external_exports.object({
|
|
27499
|
+
name: external_exports.string(),
|
|
27500
|
+
description: external_exports.string(),
|
|
27501
|
+
skillPath: external_exports.string(),
|
|
27502
|
+
origin: external_exports.enum(["system", "system-modified", "user"]).optional(),
|
|
27503
|
+
contentHash: external_exports.string().optional()
|
|
27504
|
+
});
|
|
27505
|
+
var skillPublishRecordSchema = external_exports.object({
|
|
27506
|
+
skillName: external_exports.string(),
|
|
27507
|
+
sourceId: external_exports.string(),
|
|
27508
|
+
sourceName: external_exports.string(),
|
|
27509
|
+
sourceGitUrl: external_exports.string(),
|
|
27510
|
+
prUrl: external_exports.string(),
|
|
27511
|
+
publishedAt: external_exports.string(),
|
|
27512
|
+
prState: external_exports.enum(["draft", "open", "merged", "closed"]).nullable(),
|
|
27513
|
+
prStateCheckedAt: external_exports.string().nullable()
|
|
27514
|
+
});
|
|
27515
|
+
var skillStateOutputSchema = external_exports.object({
|
|
27516
|
+
installed: external_exports.array(skillRefSchema),
|
|
27517
|
+
standalone: external_exports.array(localSkillSchema),
|
|
27518
|
+
instancePublishes: external_exports.array(skillPublishRecordSchema),
|
|
27519
|
+
standaloneSnapshot: external_exports.object({ capturedAt: external_exports.string().datetime() }).optional()
|
|
27520
|
+
});
|
|
27521
|
+
var skillListSourcesInputSchema = external_exports.object({ agentId: external_exports.string().min(1).optional() }).optional();
|
|
27522
|
+
var INVALID_GIT_URL_MESSAGE = "Enter a repository URL such as https://github.com/owner/repo";
|
|
27523
|
+
var skillCreateSourceFieldsSchema = external_exports.object({
|
|
27524
|
+
name: external_exports.string().min(1).max(128),
|
|
27525
|
+
gitUrl: external_exports.string(),
|
|
27526
|
+
path: skillSourcePathSchema.optional()
|
|
27527
|
+
});
|
|
27528
|
+
var skillCreateSourceInputSchema = skillCreateSourceFieldsSchema.transform((input, ctx) => {
|
|
27529
|
+
const location = canonicalSourceLocation(input.gitUrl, input.path);
|
|
27530
|
+
if (!location) {
|
|
27531
|
+
ctx.addIssue({
|
|
27532
|
+
code: "custom",
|
|
27533
|
+
path: ["gitUrl"],
|
|
27534
|
+
message: INVALID_GIT_URL_MESSAGE
|
|
27535
|
+
});
|
|
27536
|
+
return external_exports.NEVER;
|
|
27537
|
+
}
|
|
27538
|
+
return { name: input.name, ...location };
|
|
27539
|
+
});
|
|
27540
|
+
var skillDeleteSourceInputSchema = external_exports.object({
|
|
27541
|
+
id: external_exports.string().min(1)
|
|
27542
|
+
});
|
|
27543
|
+
var skillRefreshSourceInputSchema = external_exports.object({
|
|
27544
|
+
id: external_exports.string().min(1)
|
|
27545
|
+
});
|
|
27546
|
+
var skillListInputSchema = external_exports.object({
|
|
27547
|
+
sourceId: external_exports.string().min(1),
|
|
27548
|
+
agentId: external_exports.string().min(1).optional()
|
|
27549
|
+
});
|
|
27550
|
+
var skillGetContentInputSchema = external_exports.object({
|
|
27551
|
+
sourceId: external_exports.string().min(1),
|
|
27552
|
+
name: external_exports.string().min(1),
|
|
27553
|
+
agentId: external_exports.string().min(1).optional()
|
|
27554
|
+
});
|
|
27555
|
+
var skillContentSchema = external_exports.object({
|
|
27556
|
+
content: external_exports.string(),
|
|
27557
|
+
dir: external_exports.string().optional()
|
|
27558
|
+
});
|
|
27559
|
+
var skillInstallInputSchema2 = external_exports.object({
|
|
27560
|
+
agentId: external_exports.string().min(1),
|
|
27561
|
+
source: external_exports.string().url(),
|
|
27562
|
+
name: external_exports.string().min(1),
|
|
27563
|
+
version: external_exports.string().min(1),
|
|
27564
|
+
contentHash: external_exports.string().optional()
|
|
27565
|
+
});
|
|
27566
|
+
var skillUninstallInputSchema2 = external_exports.object({
|
|
27567
|
+
agentId: external_exports.string().min(1),
|
|
27568
|
+
source: external_exports.string().url(),
|
|
27569
|
+
name: external_exports.string().min(1)
|
|
27570
|
+
});
|
|
27571
|
+
var skillSetEntrySchema = external_exports.object({
|
|
27572
|
+
source: external_exports.string().url(),
|
|
27573
|
+
name: external_exports.string().min(1)
|
|
27574
|
+
});
|
|
27575
|
+
var skillSetNameSchema = resourceNameSchema("my-skill-set");
|
|
27576
|
+
var skillSetSchema = external_exports.object({
|
|
27577
|
+
id: external_exports.string(),
|
|
27578
|
+
name: external_exports.string(),
|
|
27579
|
+
skills: external_exports.array(skillSetEntrySchema),
|
|
27580
|
+
createdAt: external_exports.string()
|
|
27363
27581
|
});
|
|
27364
|
-
var
|
|
27365
|
-
|
|
27366
|
-
|
|
27367
|
-
version: external_exports.number().int().nonnegative(),
|
|
27368
|
-
expiresAt: external_exports.string().datetime({ offset: true }),
|
|
27369
|
-
payload: harnessConfigEventPayload
|
|
27582
|
+
var skillSetCreateInputSchema = external_exports.object({
|
|
27583
|
+
name: skillSetNameSchema,
|
|
27584
|
+
skills: external_exports.array(skillSetEntrySchema).min(1).max(500)
|
|
27370
27585
|
});
|
|
27371
|
-
var
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
|
|
27376
|
-
|
|
27377
|
-
|
|
27586
|
+
var skillSetDeleteInputSchema = external_exports.object({ id: external_exports.string().min(1) });
|
|
27587
|
+
var skillSetApplyInputSchema = external_exports.object({
|
|
27588
|
+
agentId: external_exports.string().min(1),
|
|
27589
|
+
setIds: external_exports.array(external_exports.string().min(1)).min(1).max(50)
|
|
27590
|
+
});
|
|
27591
|
+
var skillSetSkipReasonSchema = external_exports.enum([
|
|
27592
|
+
"source-not-connected",
|
|
27593
|
+
"source-unreadable",
|
|
27594
|
+
"not-in-source"
|
|
27378
27595
|
]);
|
|
27379
|
-
var
|
|
27380
|
-
|
|
27381
|
-
|
|
27382
|
-
|
|
27596
|
+
var skillSetApplyResultSchema = external_exports.object({
|
|
27597
|
+
installed: external_exports.array(skillRefSchema),
|
|
27598
|
+
added: external_exports.number().int().nonnegative(),
|
|
27599
|
+
skipped: external_exports.array(
|
|
27600
|
+
skillSetEntrySchema.extend({ reason: skillSetSkipReasonSchema })
|
|
27601
|
+
)
|
|
27383
27602
|
});
|
|
27384
|
-
var
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
|
|
27603
|
+
var MAX_SKILL_BATCH_ENTRIES = 500;
|
|
27604
|
+
var skillApplyBatchInputSchema = external_exports.object({
|
|
27605
|
+
agentId: external_exports.string().min(1),
|
|
27606
|
+
install: external_exports.array(
|
|
27607
|
+
external_exports.object({
|
|
27608
|
+
source: external_exports.string().url(),
|
|
27609
|
+
name: external_exports.string().min(1),
|
|
27610
|
+
version: external_exports.string().min(1),
|
|
27611
|
+
contentHash: external_exports.string().optional()
|
|
27612
|
+
})
|
|
27613
|
+
).max(MAX_SKILL_BATCH_ENTRIES).default([]),
|
|
27614
|
+
uninstall: external_exports.array(
|
|
27615
|
+
external_exports.object({
|
|
27616
|
+
source: external_exports.string().url(),
|
|
27617
|
+
name: external_exports.string().min(1)
|
|
27618
|
+
})
|
|
27619
|
+
).max(MAX_SKILL_BATCH_ENTRIES).default([])
|
|
27620
|
+
}).refine(
|
|
27621
|
+
(v2) => v2.install.length + v2.uninstall.length <= MAX_SKILL_BATCH_ENTRIES,
|
|
27622
|
+
{
|
|
27623
|
+
message: `one batch carries at most ${MAX_SKILL_BATCH_ENTRIES} skills, install and uninstall combined`
|
|
27624
|
+
}
|
|
27625
|
+
);
|
|
27626
|
+
var skillListLocalInputSchema2 = external_exports.object({
|
|
27627
|
+
agentId: external_exports.string().min(1)
|
|
27390
27628
|
});
|
|
27391
|
-
var
|
|
27392
|
-
|
|
27393
|
-
modelConstraints: external_exports.record(external_exports.string().min(1), external_exports.record(external_exports.string().min(1), external_exports.array(external_exports.string()))).optional()
|
|
27629
|
+
var skillStateInputSchema = external_exports.object({
|
|
27630
|
+
agentId: external_exports.string().min(1)
|
|
27394
27631
|
});
|
|
27395
|
-
var
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
configOptions: external_exports.record(external_exports.string().min(1), external_exports.string()),
|
|
27399
|
-
availableModels: external_exports.array(harnessConfigChoice).nullable().optional()
|
|
27632
|
+
var skillDeleteLocalInputSchema2 = external_exports.object({
|
|
27633
|
+
agentId: external_exports.string().min(1),
|
|
27634
|
+
name: external_exports.string().min(1)
|
|
27400
27635
|
});
|
|
27401
|
-
var
|
|
27402
|
-
|
|
27403
|
-
|
|
27404
|
-
harnessConfig: external_exports.boolean().optional(),
|
|
27405
|
-
harnessConfigCatalog: harnessConfigCatalog.optional(),
|
|
27406
|
-
kbPublish: external_exports.number().int().optional(),
|
|
27407
|
-
liveUpdates: external_exports.boolean().optional()
|
|
27636
|
+
var skillReadLocalInputSchema2 = external_exports.object({
|
|
27637
|
+
agentId: external_exports.string().min(1),
|
|
27638
|
+
name: external_exports.string().min(1)
|
|
27408
27639
|
});
|
|
27409
|
-
var
|
|
27410
|
-
|
|
27640
|
+
var skillLocalFilesSchema = external_exports.object({
|
|
27641
|
+
dir: external_exports.string(),
|
|
27642
|
+
files: external_exports.array(
|
|
27643
|
+
external_exports.object({
|
|
27644
|
+
relPath: external_exports.string(),
|
|
27645
|
+
content: external_exports.string(),
|
|
27646
|
+
base64: external_exports.literal(true).optional()
|
|
27647
|
+
})
|
|
27648
|
+
)
|
|
27411
27649
|
});
|
|
27412
|
-
var
|
|
27413
|
-
|
|
27414
|
-
|
|
27650
|
+
var skillPublishInputSchema2 = external_exports.object({
|
|
27651
|
+
agentId: external_exports.string().min(1),
|
|
27652
|
+
sourceId: external_exports.string().min(1),
|
|
27653
|
+
name: external_exports.string().min(1),
|
|
27654
|
+
title: external_exports.string().optional(),
|
|
27655
|
+
body: external_exports.string().optional()
|
|
27415
27656
|
});
|
|
27416
|
-
var
|
|
27417
|
-
|
|
27418
|
-
|
|
27419
|
-
|
|
27657
|
+
var skillCreateLocalInputSchema = external_exports.object({
|
|
27658
|
+
agentId: external_exports.string().min(1),
|
|
27659
|
+
skills: external_exports.array(
|
|
27660
|
+
external_exports.object({
|
|
27661
|
+
name: external_exports.string().min(1).max(128),
|
|
27662
|
+
content: external_exports.string().max(2 * 1024 * 1024)
|
|
27663
|
+
})
|
|
27664
|
+
).min(1).max(50)
|
|
27665
|
+
}).refine(
|
|
27666
|
+
(v2) => v2.skills.reduce((n, s) => n + s.content.length, 0) <= 5 * 1024 * 1024,
|
|
27667
|
+
"batch exceeds 5 MB"
|
|
27668
|
+
);
|
|
27669
|
+
|
|
27670
|
+
// ../api-server-api/src/modules/templates/schemas.ts
|
|
27671
|
+
var templateGetInputSchema = external_exports.object({
|
|
27672
|
+
id: external_exports.string().min(1)
|
|
27420
27673
|
});
|
|
27421
|
-
var
|
|
27422
|
-
|
|
27423
|
-
|
|
27674
|
+
var mountSchema = external_exports.object({
|
|
27675
|
+
path: external_exports.string(),
|
|
27676
|
+
persist: external_exports.boolean(),
|
|
27677
|
+
size: external_exports.string().optional()
|
|
27424
27678
|
});
|
|
27425
|
-
var
|
|
27426
|
-
external_exports.
|
|
27427
|
-
|
|
27428
|
-
appliedVersion: external_exports.number().int().nonnegative(),
|
|
27429
|
-
appliedHash: external_exports.string().min(1).nullable(),
|
|
27430
|
-
failures: external_exports.array(driverFailure).default([]),
|
|
27431
|
-
settledEvents: external_exports.array(external_exports.string()).default([]),
|
|
27432
|
-
harnessConfigCurrent: harnessConfigCurrent.optional()
|
|
27433
|
-
}),
|
|
27434
|
-
external_exports.object({
|
|
27435
|
-
status: external_exports.literal("stale"),
|
|
27436
|
-
appliedVersion: external_exports.number().int().nonnegative(),
|
|
27437
|
-
settledEvents: external_exports.array(external_exports.string()).default([]),
|
|
27438
|
-
harnessConfigCurrent: harnessConfigCurrent.optional()
|
|
27439
|
-
})
|
|
27440
|
-
]);
|
|
27441
|
-
var helloInput = external_exports.object({
|
|
27442
|
-
lastAppliedVersion: external_exports.number().int().nonnegative().optional(),
|
|
27443
|
-
lastAppliedHash: external_exports.string().optional(),
|
|
27444
|
-
protocolVersion: external_exports.literal("v1"),
|
|
27445
|
-
agentRuntimeVersion: external_exports.string(),
|
|
27446
|
-
capabilities,
|
|
27447
|
-
harnessConfigCurrent: harnessConfigCurrent.optional()
|
|
27679
|
+
var resourcesSchema = external_exports.object({
|
|
27680
|
+
requests: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
27681
|
+
limits: external_exports.record(external_exports.string(), external_exports.string()).optional()
|
|
27448
27682
|
});
|
|
27449
|
-
var
|
|
27450
|
-
|
|
27451
|
-
|
|
27452
|
-
|
|
27683
|
+
var envVarConfigMapSchema = external_exports.object({
|
|
27684
|
+
name: external_exports.string(),
|
|
27685
|
+
value: external_exports.string()
|
|
27686
|
+
});
|
|
27687
|
+
var skillSourceSeedSchema = external_exports.object({
|
|
27688
|
+
name: external_exports.string(),
|
|
27689
|
+
gitUrl: external_exports.string(),
|
|
27690
|
+
path: skillSourcePathSchema.optional()
|
|
27453
27691
|
});
|
|
27692
|
+
var templateCategorySchema = external_exports.enum(["harness"]).default("harness");
|
|
27693
|
+
var harnessFamilySchema = external_exports.enum([
|
|
27694
|
+
"claude-code",
|
|
27695
|
+
"codex",
|
|
27696
|
+
"pi",
|
|
27697
|
+
"bob"
|
|
27698
|
+
]);
|
|
27699
|
+
var templateSpecSchema = external_exports.object({
|
|
27700
|
+
version: external_exports.string(),
|
|
27701
|
+
image: external_exports.string(),
|
|
27702
|
+
name: external_exports.string().optional(),
|
|
27703
|
+
description: external_exports.string().optional(),
|
|
27704
|
+
category: templateCategorySchema,
|
|
27705
|
+
harness: harnessFamilySchema.optional(),
|
|
27706
|
+
providers: external_exports.array(
|
|
27707
|
+
external_exports.custom(
|
|
27708
|
+
(v2) => typeof v2 === "string" && isProviderPresetType(v2),
|
|
27709
|
+
"unknown provider type"
|
|
27710
|
+
)
|
|
27711
|
+
).optional(),
|
|
27712
|
+
tags: external_exports.array(external_exports.string()).optional(),
|
|
27713
|
+
docsUrl: external_exports.string().optional(),
|
|
27714
|
+
releaseNotesUrl: external_exports.string().optional(),
|
|
27715
|
+
setupNote: external_exports.object({ title: external_exports.string(), body: external_exports.string() }).optional(),
|
|
27716
|
+
experimental: external_exports.boolean().optional(),
|
|
27717
|
+
mounts: external_exports.array(mountSchema).optional(),
|
|
27718
|
+
init: external_exports.string().optional(),
|
|
27719
|
+
env: external_exports.array(envVarConfigMapSchema).optional(),
|
|
27720
|
+
resources: resourcesSchema.optional(),
|
|
27721
|
+
imagePullPolicy: external_exports.string().optional(),
|
|
27722
|
+
imagePullSecretRef: external_exports.string().optional(),
|
|
27723
|
+
hibernationTimeout: external_exports.string().optional(),
|
|
27724
|
+
storageSize: external_exports.string().optional(),
|
|
27725
|
+
storageClass: external_exports.string().optional(),
|
|
27726
|
+
runtimeClassName: external_exports.string().optional(),
|
|
27727
|
+
nodeSelector: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
27728
|
+
skillSources: external_exports.array(skillSourceSeedSchema).optional()
|
|
27729
|
+
}).passthrough();
|
|
27454
27730
|
|
|
27455
|
-
// ../
|
|
27456
|
-
var
|
|
27457
|
-
|
|
27458
|
-
|
|
27459
|
-
|
|
27460
|
-
|
|
27461
|
-
|
|
27462
|
-
|
|
27731
|
+
// ../api-server-api/src/modules/repos/schemas.ts
|
|
27732
|
+
var repoSchema = external_exports.object({
|
|
27733
|
+
id: external_exports.string().min(1),
|
|
27734
|
+
name: external_exports.string().min(1),
|
|
27735
|
+
url: external_exports.url(),
|
|
27736
|
+
ref: external_exports.string().min(1).optional(),
|
|
27737
|
+
description: external_exports.string().optional(),
|
|
27738
|
+
compatibleTemplates: external_exports.array(external_exports.string()).default([])
|
|
27463
27739
|
});
|
|
27464
27740
|
|
|
27465
|
-
// ../
|
|
27466
|
-
var
|
|
27467
|
-
|
|
27468
|
-
|
|
27469
|
-
|
|
27741
|
+
// ../api-server-api/src/modules/invocations/schemas.ts
|
|
27742
|
+
var DEFAULT_INVOCATION_TTL_MS = 60 * 60 * 1e3;
|
|
27743
|
+
var MIN_INVOCATION_TTL_MS = 60 * 1e3;
|
|
27744
|
+
var MAX_INVOCATION_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
27745
|
+
var spawnInvocationRequestSchema = external_exports.object({
|
|
27746
|
+
image: external_exports.string().min(1).optional(),
|
|
27747
|
+
templateId: external_exports.string().min(1).optional(),
|
|
27748
|
+
connections: external_exports.array(external_exports.string().min(1)).optional(),
|
|
27749
|
+
prompt: external_exports.string().min(1),
|
|
27750
|
+
schema: external_exports.unknown(),
|
|
27751
|
+
ttlMs: external_exports.number().int().min(MIN_INVOCATION_TTL_MS).max(MAX_INVOCATION_TTL_MS).optional(),
|
|
27752
|
+
memory: external_exports.string().regex(/^\d+(Mi|Gi)$/, "memory must look like '512Mi' or '4Gi'").optional(),
|
|
27753
|
+
cpu: external_exports.string().regex(/^\d+(\.\d+)?m?$/, "cpu must look like '2', '0.5' or '500m'").optional(),
|
|
27754
|
+
experimentSpanId: external_exports.string().min(1).max(300).optional()
|
|
27755
|
+
}).refine((d2) => d2.image !== void 0 || d2.templateId !== void 0, {
|
|
27756
|
+
message: "either image or templateId is required"
|
|
27757
|
+
});
|
|
27758
|
+
var spawnInvocationResponseSchema = external_exports.object({
|
|
27759
|
+
id: external_exports.string().min(1)
|
|
27760
|
+
});
|
|
27761
|
+
var invocationViewSchema = external_exports.object({
|
|
27762
|
+
status: external_exports.enum(["running", "done", "failed"]),
|
|
27763
|
+
result: external_exports.unknown(),
|
|
27764
|
+
errorReason: external_exports.string().optional()
|
|
27470
27765
|
});
|
|
27471
27766
|
|
|
27472
27767
|
// ../api-server-api/src/modules/harness-config/schemas.ts
|
|
@@ -27558,6 +27853,13 @@ var agentSizeSchema = external_exports.object({
|
|
|
27558
27853
|
cpu: cpuQuantitySchema.optional(),
|
|
27559
27854
|
memory: memoryQuantitySchema.optional()
|
|
27560
27855
|
});
|
|
27856
|
+
var storageQuantitySchema = external_exports.string().regex(/^\d+(Mi|Gi)$/, "storage must look like '512Mi' or '10Gi'").refine((v2) => toMemoryMi(v2) >= 1024, {
|
|
27857
|
+
message: "storage must be at least 1Gi"
|
|
27858
|
+
});
|
|
27859
|
+
var agentRetryWorkspaceInputSchema = external_exports.object({
|
|
27860
|
+
id: external_exports.string().min(1),
|
|
27861
|
+
kind: external_exports.enum(["workspace-seed", "workspace-command"])
|
|
27862
|
+
});
|
|
27561
27863
|
var agentUpgradeInputSchema = idSchema.extend({
|
|
27562
27864
|
expectedToImage: external_exports.string().min(1).optional()
|
|
27563
27865
|
});
|
|
@@ -27565,10 +27867,13 @@ var agentDisconnectSlackInputSchema = idSchema.extend({
|
|
|
27565
27867
|
slackChannelId: external_exports.string().min(1).optional()
|
|
27566
27868
|
});
|
|
27567
27869
|
var agentKindSchema = external_exports.enum(["knowledge-base", "experiment"]);
|
|
27870
|
+
var AGENT_ID_RE = /^agent-[0-9a-f]{16}$/;
|
|
27871
|
+
var agentNameSchema = external_exports.string().min(1).refine((n) => !AGENT_ID_RE.test(n), {
|
|
27872
|
+
message: "agent name cannot have the shape of an agent ID"
|
|
27873
|
+
});
|
|
27568
27874
|
var agentCreateInputSchema = external_exports.object({
|
|
27569
|
-
|
|
27570
|
-
|
|
27571
|
-
}),
|
|
27875
|
+
kbShareRoots: external_exports.array(external_exports.string().min(1)).min(1).max(20).optional(),
|
|
27876
|
+
name: agentNameSchema,
|
|
27572
27877
|
templateId: external_exports.string().optional(),
|
|
27573
27878
|
image: external_exports.string().optional(),
|
|
27574
27879
|
description: external_exports.string().optional(),
|
|
@@ -27581,9 +27886,18 @@ var agentCreateInputSchema = external_exports.object({
|
|
|
27581
27886
|
}).optional(),
|
|
27582
27887
|
egressPreset: egressPresetSchema.optional(),
|
|
27583
27888
|
hibernationTimeoutMin: external_exports.number().int().min(0).optional(),
|
|
27584
|
-
gitRepo: external_exports.object({
|
|
27889
|
+
gitRepo: external_exports.object({
|
|
27890
|
+
url: external_exports.url(),
|
|
27891
|
+
ref: external_exports.string().min(1).optional(),
|
|
27892
|
+
commit: external_exports.string().min(1).optional(),
|
|
27893
|
+
branch: external_exports.string().min(1).optional(),
|
|
27894
|
+
into: external_exports.enum(["work", "home"]).optional()
|
|
27895
|
+
}).optional(),
|
|
27585
27896
|
connectionIds: external_exports.array(external_exports.string()).optional(),
|
|
27897
|
+
providerConnectionId: external_exports.string().min(1).optional(),
|
|
27586
27898
|
size: agentSizeSchema.optional(),
|
|
27899
|
+
vm: external_exports.boolean().optional(),
|
|
27900
|
+
storage: storageQuantitySchema.optional(),
|
|
27587
27901
|
sweepable: external_exports.boolean().optional(),
|
|
27588
27902
|
lifetimeMs: external_exports.number().int().min(0).optional()
|
|
27589
27903
|
}).refine((d2) => d2.templateId !== void 0 || d2.image !== void 0, {
|
|
@@ -27614,6 +27928,9 @@ var agentBindTelegramChatInputSchema = external_exports.object({
|
|
|
27614
27928
|
agentId: external_exports.string().min(1),
|
|
27615
27929
|
flowId: external_exports.string().min(1)
|
|
27616
27930
|
});
|
|
27931
|
+
var agentPeekBindFlowInputSchema = external_exports.object({
|
|
27932
|
+
flowId: external_exports.string().min(1)
|
|
27933
|
+
});
|
|
27617
27934
|
var agentBindSlackChannelInputSchema = external_exports.object({
|
|
27618
27935
|
agentId: external_exports.string().min(1),
|
|
27619
27936
|
flowId: external_exports.string().min(1)
|
|
@@ -27635,12 +27952,15 @@ var scheduleListInputSchema = external_exports.object({
|
|
|
27635
27952
|
var scheduleGetInputSchema = external_exports.object({
|
|
27636
27953
|
id: external_exports.string().min(1)
|
|
27637
27954
|
});
|
|
27955
|
+
var PRECHECK_MAX_LENGTH = 8e3;
|
|
27956
|
+
var precheckSchema = external_exports.string().trim().min(1).max(PRECHECK_MAX_LENGTH);
|
|
27638
27957
|
var scheduleCreateCronInputSchema = external_exports.object({
|
|
27639
27958
|
name: external_exports.string().min(1),
|
|
27640
27959
|
agentId: external_exports.string().min(1),
|
|
27641
27960
|
cron: external_exports.string().min(1),
|
|
27642
27961
|
task: external_exports.string().min(1),
|
|
27643
|
-
sessionMode: scheduleSessionModeSchema.optional()
|
|
27962
|
+
sessionMode: scheduleSessionModeSchema.optional(),
|
|
27963
|
+
precheck: precheckSchema.optional()
|
|
27644
27964
|
});
|
|
27645
27965
|
var scheduleCreateRRuleInputSchema = external_exports.object({
|
|
27646
27966
|
name: external_exports.string().min(1),
|
|
@@ -27649,7 +27969,8 @@ var scheduleCreateRRuleInputSchema = external_exports.object({
|
|
|
27649
27969
|
timezone: external_exports.string().min(1),
|
|
27650
27970
|
quietHours: external_exports.array(quietWindowSchema).optional(),
|
|
27651
27971
|
task: external_exports.string().min(1),
|
|
27652
|
-
sessionMode: scheduleSessionModeSchema.optional()
|
|
27972
|
+
sessionMode: scheduleSessionModeSchema.optional(),
|
|
27973
|
+
precheck: precheckSchema.optional()
|
|
27653
27974
|
});
|
|
27654
27975
|
var scheduleUpdateRRuleInputSchema = external_exports.object({
|
|
27655
27976
|
id: external_exports.string().min(1),
|
|
@@ -27658,7 +27979,8 @@ var scheduleUpdateRRuleInputSchema = external_exports.object({
|
|
|
27658
27979
|
timezone: external_exports.string().min(1),
|
|
27659
27980
|
quietHours: external_exports.array(quietWindowSchema),
|
|
27660
27981
|
task: external_exports.string().min(1),
|
|
27661
|
-
sessionMode: scheduleSessionModeSchema.optional()
|
|
27982
|
+
sessionMode: scheduleSessionModeSchema.optional(),
|
|
27983
|
+
precheck: precheckSchema.nullable().optional()
|
|
27662
27984
|
});
|
|
27663
27985
|
var scheduleDeleteInputSchema = external_exports.object({
|
|
27664
27986
|
id: external_exports.string().min(1)
|
|
@@ -27680,6 +28002,7 @@ var scheduleSpecCronSchema = external_exports.object({
|
|
|
27680
28002
|
type: external_exports.literal("cron"),
|
|
27681
28003
|
cron: external_exports.string(),
|
|
27682
28004
|
task: external_exports.string().optional(),
|
|
28005
|
+
precheck: precheckSchema.optional(),
|
|
27683
28006
|
enabled: external_exports.boolean(),
|
|
27684
28007
|
sessionMode: scheduleSessionModeSchema.optional(),
|
|
27685
28008
|
createdBy: scheduleCreatorSchema
|
|
@@ -27691,6 +28014,7 @@ var scheduleSpecRRuleSchema = external_exports.object({
|
|
|
27691
28014
|
timezone: external_exports.string(),
|
|
27692
28015
|
quietHours: external_exports.array(quietWindowConfigMapSchema).optional(),
|
|
27693
28016
|
task: external_exports.string().optional(),
|
|
28017
|
+
precheck: precheckSchema.optional(),
|
|
27694
28018
|
enabled: external_exports.boolean(),
|
|
27695
28019
|
sessionMode: scheduleSessionModeSchema.optional(),
|
|
27696
28020
|
createdBy: scheduleCreatorSchema
|
|
@@ -27702,8 +28026,17 @@ var scheduleSpecSchema = external_exports.discriminatedUnion("type", [
|
|
|
27702
28026
|
var scheduleStatusSchema = external_exports.object({
|
|
27703
28027
|
lastRun: external_exports.string().optional(),
|
|
27704
28028
|
nextRun: external_exports.string().optional(),
|
|
27705
|
-
lastResult: external_exports.string().optional()
|
|
27706
|
-
|
|
28029
|
+
lastResult: external_exports.string().optional(),
|
|
28030
|
+
lastDeclinedAt: external_exports.string().optional(),
|
|
28031
|
+
declinedCount: external_exports.number().int().nonnegative().optional(),
|
|
28032
|
+
lastPrecheckError: external_exports.string().optional(),
|
|
28033
|
+
precheckFailedCount: external_exports.number().int().nonnegative().optional()
|
|
28034
|
+
});
|
|
28035
|
+
var precheckVerdictSchema = external_exports.enum([
|
|
28036
|
+
"allowed",
|
|
28037
|
+
"declined",
|
|
28038
|
+
"precheck-failed"
|
|
28039
|
+
]);
|
|
27707
28040
|
|
|
27708
28041
|
// ../api-server-api/src/modules/experiments/schemas.ts
|
|
27709
28042
|
var SCRIPT_CONTENT_MAX_BYTES = 256 * 1024;
|
|
@@ -27797,9 +28130,7 @@ var experimentIdInputSchema = external_exports.object({
|
|
|
27797
28130
|
id: external_exports.string().min(1)
|
|
27798
28131
|
});
|
|
27799
28132
|
var experimentSandboxCreateInputSchema = external_exports.object({
|
|
27800
|
-
name:
|
|
27801
|
-
message: "agent name cannot start with 'agent-' (reserved for IDs)"
|
|
27802
|
-
}),
|
|
28133
|
+
name: agentNameSchema,
|
|
27803
28134
|
templateId: external_exports.string().optional(),
|
|
27804
28135
|
image: external_exports.string().optional(),
|
|
27805
28136
|
description: external_exports.string().optional(),
|
|
@@ -27810,21 +28141,160 @@ var experimentSandboxCreateInputSchema = external_exports.object({
|
|
|
27810
28141
|
message: "Either templateId or image is required"
|
|
27811
28142
|
});
|
|
27812
28143
|
|
|
27813
|
-
// ../api-server-api/src/modules/
|
|
27814
|
-
var
|
|
27815
|
-
var
|
|
27816
|
-
|
|
27817
|
-
|
|
27818
|
-
|
|
27819
|
-
|
|
27820
|
-
|
|
27821
|
-
|
|
27822
|
-
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
})
|
|
27827
|
-
|
|
28144
|
+
// ../api-server-api/src/modules/starter-kits/schemas.ts
|
|
28145
|
+
var starterKitIdSchema = external_exports.string().min(1).regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes");
|
|
28146
|
+
var starterKitCatalogNameSchema = starterKitIdSchema;
|
|
28147
|
+
var starterKitCategorySchema = external_exports.enum([
|
|
28148
|
+
"knowledge",
|
|
28149
|
+
"software",
|
|
28150
|
+
"productivity",
|
|
28151
|
+
"research"
|
|
28152
|
+
]);
|
|
28153
|
+
var starterKitConnectionRequirementSchema = external_exports.object({
|
|
28154
|
+
accepts: external_exports.array(external_exports.string().min(1)).min(1),
|
|
28155
|
+
required: external_exports.boolean().default(false),
|
|
28156
|
+
note: external_exports.string().optional()
|
|
28157
|
+
});
|
|
28158
|
+
var starterKitChannelSchema = external_exports.object({
|
|
28159
|
+
type: external_exports.enum(["slack", "telegram"]),
|
|
28160
|
+
note: external_exports.string().optional()
|
|
28161
|
+
});
|
|
28162
|
+
var scheduleCommon = {
|
|
28163
|
+
name: external_exports.string().min(1),
|
|
28164
|
+
task: external_exports.string().min(1),
|
|
28165
|
+
enabled: external_exports.boolean().default(true),
|
|
28166
|
+
sessionMode: external_exports.enum(["continuous", "fresh"]).optional(),
|
|
28167
|
+
precheck: precheckSchema.optional()
|
|
28168
|
+
};
|
|
28169
|
+
var starterKitCronScheduleSchema = external_exports.object({
|
|
28170
|
+
...scheduleCommon,
|
|
28171
|
+
cron: external_exports.string().min(1)
|
|
28172
|
+
});
|
|
28173
|
+
var starterKitRRuleScheduleSchema = external_exports.object({
|
|
28174
|
+
...scheduleCommon,
|
|
28175
|
+
rrule: external_exports.string().min(1),
|
|
28176
|
+
timezone: external_exports.string().min(1)
|
|
28177
|
+
});
|
|
28178
|
+
var starterKitScheduleSchema = external_exports.union([
|
|
28179
|
+
starterKitCronScheduleSchema,
|
|
28180
|
+
starterKitRRuleScheduleSchema
|
|
28181
|
+
]);
|
|
28182
|
+
var starterKitExternalSkillSchema = external_exports.object({
|
|
28183
|
+
source: external_exports.url(),
|
|
28184
|
+
name: external_exports.string().min(1)
|
|
28185
|
+
});
|
|
28186
|
+
var starterKitBundledSkillsSchema = external_exports.object({
|
|
28187
|
+
path: external_exports.string().min(1)
|
|
28188
|
+
});
|
|
28189
|
+
var resolvedSkillSchema = external_exports.object({
|
|
28190
|
+
name: external_exports.string().min(1),
|
|
28191
|
+
description: external_exports.string()
|
|
28192
|
+
});
|
|
28193
|
+
var starterKitEnvVarSchema = external_exports.object({
|
|
28194
|
+
name: external_exports.string().min(1),
|
|
28195
|
+
value: external_exports.string()
|
|
28196
|
+
});
|
|
28197
|
+
var providerListSchema = external_exports.array(
|
|
28198
|
+
external_exports.custom(
|
|
28199
|
+
(v2) => typeof v2 === "string" && isProviderPresetType(v2),
|
|
28200
|
+
"unknown provider type"
|
|
28201
|
+
)
|
|
28202
|
+
);
|
|
28203
|
+
var starterKitImageSchema = external_exports.object({
|
|
28204
|
+
ref: external_exports.string().min(1),
|
|
28205
|
+
harness: harnessFamilySchema.optional(),
|
|
28206
|
+
providers: providerListSchema.optional()
|
|
28207
|
+
});
|
|
28208
|
+
var starterKitKnowledgeBaseSchema = external_exports.object({
|
|
28209
|
+
shareRoots: external_exports.array(external_exports.string().min(1)).min(1).max(20)
|
|
28210
|
+
});
|
|
28211
|
+
var starterKitInstallSchema = external_exports.object({
|
|
28212
|
+
command: external_exports.string().min(1)
|
|
28213
|
+
});
|
|
28214
|
+
var starterKitResourcesSchema = agentSizeSchema.extend({
|
|
28215
|
+
storage: storageQuantitySchema.optional(),
|
|
28216
|
+
note: external_exports.string().min(1).optional()
|
|
28217
|
+
});
|
|
28218
|
+
var harnessCommandNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9:_-]*$/, "a command name without the leading slash");
|
|
28219
|
+
var starterKitSchema = external_exports.object({
|
|
28220
|
+
schemaVersion: external_exports.literal("v1"),
|
|
28221
|
+
id: starterKitIdSchema,
|
|
28222
|
+
name: external_exports.string().min(1),
|
|
28223
|
+
description: external_exports.string().min(1),
|
|
28224
|
+
tagline: external_exports.string().min(1).optional(),
|
|
28225
|
+
category: starterKitCategorySchema,
|
|
28226
|
+
icon: external_exports.string().min(1).optional(),
|
|
28227
|
+
video: external_exports.url().optional(),
|
|
28228
|
+
docsUrl: external_exports.url().optional(),
|
|
28229
|
+
image: starterKitImageSchema.optional(),
|
|
28230
|
+
resources: starterKitResourcesSchema.optional(),
|
|
28231
|
+
knowledgeBase: starterKitKnowledgeBaseSchema.optional(),
|
|
28232
|
+
install: starterKitInstallSchema.optional(),
|
|
28233
|
+
harnesses: external_exports.array(harnessFamilySchema).min(1).optional(),
|
|
28234
|
+
providers: providerListSchema.min(1).optional(),
|
|
28235
|
+
seed: external_exports.object({
|
|
28236
|
+
url: external_exports.url().optional(),
|
|
28237
|
+
self: external_exports.literal(true).optional(),
|
|
28238
|
+
ref: external_exports.string().min(1).optional(),
|
|
28239
|
+
commit: external_exports.string().regex(/^[0-9a-f]{40}$/i).optional(),
|
|
28240
|
+
into: external_exports.enum(["work", "home"]).default("work")
|
|
28241
|
+
}).meta({
|
|
28242
|
+
oneOf: [{ required: ["url"] }, { required: ["self"] }]
|
|
28243
|
+
}).refine((seed) => (seed.url ? 1 : 0) + (seed.self ? 1 : 0) === 1, {
|
|
28244
|
+
message: "a seed names exactly one of `url` (another repository) or `self: true` (the repository this kit is read from)"
|
|
28245
|
+
}).optional(),
|
|
28246
|
+
onboarding: external_exports.union([
|
|
28247
|
+
external_exports.literal(false),
|
|
28248
|
+
external_exports.object({ prompt: external_exports.string().min(1) }),
|
|
28249
|
+
external_exports.object({ command: harnessCommandNameSchema })
|
|
28250
|
+
]).optional(),
|
|
28251
|
+
connections: external_exports.array(starterKitConnectionRequirementSchema).default([]),
|
|
28252
|
+
channels: external_exports.array(starterKitChannelSchema).default([]),
|
|
28253
|
+
schedules: external_exports.array(starterKitScheduleSchema).default([]),
|
|
28254
|
+
skills: external_exports.array(starterKitExternalSkillSchema).default([]),
|
|
28255
|
+
bundledSkills: starterKitBundledSkillsSchema.optional(),
|
|
28256
|
+
env: external_exports.array(starterKitEnvVarSchema).default([]),
|
|
28257
|
+
hibernationTimeoutMin: external_exports.number().int().min(0).optional()
|
|
28258
|
+
});
|
|
28259
|
+
var onboardingStepSchema = external_exports.object({
|
|
28260
|
+
id: external_exports.string().min(1).max(64),
|
|
28261
|
+
label: external_exports.string().min(1).max(120),
|
|
28262
|
+
done: external_exports.boolean()
|
|
28263
|
+
});
|
|
28264
|
+
var starterKitCatalogEntrySchema = external_exports.object({
|
|
28265
|
+
path: external_exports.string().min(1).default("."),
|
|
28266
|
+
url: external_exports.url().optional(),
|
|
28267
|
+
ref: external_exports.string().min(1).optional()
|
|
28268
|
+
});
|
|
28269
|
+
var starterKitCatalogSchema = external_exports.object({
|
|
28270
|
+
kits: external_exports.array(starterKitCatalogEntrySchema)
|
|
28271
|
+
});
|
|
28272
|
+
var starterKitGetInputSchema = external_exports.object({
|
|
28273
|
+
catalog: starterKitCatalogNameSchema,
|
|
28274
|
+
id: starterKitIdSchema
|
|
28275
|
+
});
|
|
28276
|
+
var starterKitScheduleTimingSchema = external_exports.union([
|
|
28277
|
+
external_exports.object({ cron: external_exports.string().min(1) }),
|
|
28278
|
+
external_exports.object({ rrule: external_exports.string().min(1), timezone: external_exports.string().min(1) })
|
|
28279
|
+
]);
|
|
28280
|
+
var starterKitScheduleOverrideSchema = external_exports.object({
|
|
28281
|
+
name: external_exports.string().min(1),
|
|
28282
|
+
timing: starterKitScheduleTimingSchema.optional(),
|
|
28283
|
+
sessionMode: external_exports.enum(["continuous", "fresh"]).optional(),
|
|
28284
|
+
enabled: external_exports.boolean().optional(),
|
|
28285
|
+
quietHours: external_exports.array(quietWindowSchema).optional(),
|
|
28286
|
+
precheck: precheckSchema.nullable().optional()
|
|
28287
|
+
});
|
|
28288
|
+
var starterKitApplyInputSchema = external_exports.object({
|
|
28289
|
+
catalog: starterKitCatalogNameSchema,
|
|
28290
|
+
kitId: starterKitIdSchema,
|
|
28291
|
+
name: agentNameSchema,
|
|
28292
|
+
templateId: external_exports.string().min(1).optional(),
|
|
28293
|
+
connectionIds: external_exports.array(external_exports.string().min(1)).default([]),
|
|
28294
|
+
slackChannelId: external_exports.string().min(1).optional(),
|
|
28295
|
+
skipSchedules: external_exports.array(external_exports.string().min(1)).default([]),
|
|
28296
|
+
scheduleOverrides: external_exports.array(starterKitScheduleOverrideSchema).default([]),
|
|
28297
|
+
skipSeed: external_exports.boolean().optional()
|
|
27828
28298
|
});
|
|
27829
28299
|
|
|
27830
28300
|
// ../api-server-api/src/modules/kb-shares/schemas.ts
|
|
@@ -27853,6 +28323,14 @@ var kbSharePublishStateSchema = external_exports.enum([
|
|
|
27853
28323
|
"failed"
|
|
27854
28324
|
]);
|
|
27855
28325
|
|
|
28326
|
+
// ../api-server-api/src/modules/artifact-library/prompt.ts
|
|
28327
|
+
var ARTIFACT_PROMPT_TYPE = "artifact.prompt";
|
|
28328
|
+
var ARTIFACT_PROMPT_MAX_LENGTH = 16384;
|
|
28329
|
+
var artifactPromptSchema = external_exports.object({
|
|
28330
|
+
type: external_exports.literal(ARTIFACT_PROMPT_TYPE),
|
|
28331
|
+
prompt: external_exports.string().trim().min(1).max(ARTIFACT_PROMPT_MAX_LENGTH)
|
|
28332
|
+
});
|
|
28333
|
+
|
|
27856
28334
|
// ../api-server-api/src/modules/artifact-library/schemas.ts
|
|
27857
28335
|
var artifactKindSchema = external_exports.enum([
|
|
27858
28336
|
"html",
|
|
@@ -27870,6 +28348,7 @@ var artifactVisibilitySchema = external_exports.enum([
|
|
|
27870
28348
|
var artifactCreateVisibilitySchema = external_exports.enum(["private", "public"]);
|
|
27871
28349
|
var VIEWER_ALLOWLIST_MAX = 50;
|
|
27872
28350
|
var viewerEmailSchema = external_exports.string().trim().toLowerCase().pipe(external_exports.email().max(254));
|
|
28351
|
+
var artifactVersionAuthorSchema = external_exports.enum(["user", "agent"]);
|
|
27873
28352
|
var ARTIFACT_TITLE_MAX_LENGTH = 300;
|
|
27874
28353
|
var titleSchema = external_exports.string().trim().min(1, "title is required").max(ARTIFACT_TITLE_MAX_LENGTH);
|
|
27875
28354
|
var fileNameSchema = external_exports.string().trim().min(1).max(255);
|
|
@@ -27889,6 +28368,7 @@ var contentOrUploadRef = {
|
|
|
27889
28368
|
content: external_exports.string().max(INLINE_CONTENT_MAX_BYTES).optional(),
|
|
27890
28369
|
uploadRef: external_exports.string().min(1).max(1024).optional()
|
|
27891
28370
|
};
|
|
28371
|
+
var sourcePathSchema = external_exports.string().trim().min(1).max(1024);
|
|
27892
28372
|
var artifactCreateInputSchema = external_exports.object({
|
|
27893
28373
|
title: titleSchema,
|
|
27894
28374
|
...contentOrUploadRef,
|
|
@@ -27897,7 +28377,10 @@ var artifactCreateInputSchema = external_exports.object({
|
|
|
27897
28377
|
contentType: external_exports.string().trim().min(1).max(200).optional(),
|
|
27898
28378
|
folderId: external_exports.string().min(1).optional(),
|
|
27899
28379
|
visibility: artifactCreateVisibilitySchema.optional(),
|
|
27900
|
-
|
|
28380
|
+
interactive: external_exports.boolean().optional(),
|
|
28381
|
+
expiresInHours: expiresInHoursSchema.nullish(),
|
|
28382
|
+
sourcePath: sourcePathSchema.optional(),
|
|
28383
|
+
agentId: external_exports.string().min(1).optional()
|
|
27901
28384
|
}).refine((v2) => v2.content == null !== (v2.uploadRef == null), {
|
|
27902
28385
|
message: "provide exactly one of content or uploadRef",
|
|
27903
28386
|
path: ["content"]
|
|
@@ -27908,7 +28391,9 @@ var artifactUpdateInputSchema = external_exports.object({
|
|
|
27908
28391
|
folderId: external_exports.string().min(1).nullish(),
|
|
27909
28392
|
...contentOrUploadRef,
|
|
27910
28393
|
fileName: fileNameSchema.optional(),
|
|
27911
|
-
contentType: external_exports.string().trim().min(1).max(200).optional()
|
|
28394
|
+
contentType: external_exports.string().trim().min(1).max(200).optional(),
|
|
28395
|
+
sourcePath: sourcePathSchema.optional(),
|
|
28396
|
+
expectedVersion: external_exports.number().int().positive().optional()
|
|
27912
28397
|
}).refine((v2) => !(v2.content != null && v2.uploadRef != null), {
|
|
27913
28398
|
message: "provide at most one of content or uploadRef",
|
|
27914
28399
|
path: ["content"]
|
|
@@ -27956,7 +28441,9 @@ var artifactTouchListInputSchema = external_exports.object({
|
|
|
27956
28441
|
var featureIdSchema = external_exports.enum([
|
|
27957
28442
|
"advanced-connections",
|
|
27958
28443
|
"vm-sandboxes",
|
|
27959
|
-
"session-costs"
|
|
28444
|
+
"session-costs",
|
|
28445
|
+
"interactive-artifacts",
|
|
28446
|
+
"agent-telemetry"
|
|
27960
28447
|
]);
|
|
27961
28448
|
var featureSetFlagInputSchema = external_exports.object({
|
|
27962
28449
|
feature: featureIdSchema,
|
|
@@ -31006,153 +31493,6 @@ function parseHHMM(s) {
|
|
|
31006
31493
|
return h2 * 60 + mi;
|
|
31007
31494
|
}
|
|
31008
31495
|
|
|
31009
|
-
// ../api-server-api/src/modules/connections/providers.ts
|
|
31010
|
-
var DEFAULT_ENV_PLACEHOLDER = "dummy-placeholder";
|
|
31011
|
-
var IBM_LITELLM_HOST = "ete-litellm.ai-models.vpc.res.ibm.com";
|
|
31012
|
-
var IBM_LITELLM_BASE_URL = `https://${IBM_LITELLM_HOST}`;
|
|
31013
|
-
function ibmLitellmEnvMappings() {
|
|
31014
|
-
return [
|
|
31015
|
-
{ envName: "ANTHROPIC_AUTH_TOKEN", placeholder: "sk-dummy" },
|
|
31016
|
-
{ envName: "ANTHROPIC_BASE_URL", placeholder: IBM_LITELLM_BASE_URL },
|
|
31017
|
-
{ envName: "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS", placeholder: "1" },
|
|
31018
|
-
{ envName: "OPENAI_PROXY_URL", placeholder: IBM_LITELLM_BASE_URL },
|
|
31019
|
-
{ envName: "OPENAI_PROXY_MODEL", placeholder: "aws/claude-opus-4-8" },
|
|
31020
|
-
{ envName: "OPENAI_PROXY_CONTEXT_WINDOW", placeholder: "200000" },
|
|
31021
|
-
{ envName: "OPENAI_PROXY_MAX_TOKENS", placeholder: "8192" },
|
|
31022
|
-
{ envName: "OPENAI_API_KEY", placeholder: DEFAULT_ENV_PLACEHOLDER },
|
|
31023
|
-
{ envName: "OPENAI_BASE_URL", placeholder: IBM_LITELLM_BASE_URL },
|
|
31024
|
-
{ envName: "OPENAI_MODEL", placeholder: "gpt-5.5" }
|
|
31025
|
-
];
|
|
31026
|
-
}
|
|
31027
|
-
function openaiEnvMappings() {
|
|
31028
|
-
return [
|
|
31029
|
-
{ envName: "OPENAI_API_KEY", placeholder: DEFAULT_ENV_PLACEHOLDER },
|
|
31030
|
-
{ envName: "OPENAI_BASE_URL", placeholder: "https://api.openai.com/v1" }
|
|
31031
|
-
];
|
|
31032
|
-
}
|
|
31033
|
-
var BOB_HOST = "api.us-east.bob.ibm.com";
|
|
31034
|
-
var BOB_PLACEHOLDER = "dummy-placeholder";
|
|
31035
|
-
function bobEnvMappings(pins = {}) {
|
|
31036
|
-
const out = [
|
|
31037
|
-
{ envName: "BOBSHELL_API_KEY", placeholder: BOB_PLACEHOLDER }
|
|
31038
|
-
];
|
|
31039
|
-
const push = (envName, value) => {
|
|
31040
|
-
const trimmed = value?.trim();
|
|
31041
|
-
if (trimmed) out.push({ envName, placeholder: trimmed });
|
|
31042
|
-
};
|
|
31043
|
-
push("BOB_SHELL_MODEL", pins.model);
|
|
31044
|
-
push("BOB_INSTANCE_ID", pins.agentId);
|
|
31045
|
-
push("BOB_TEAM_ID", pins.teamId);
|
|
31046
|
-
push("BOB_MAX_COINS", pins.maxCost);
|
|
31047
|
-
push("BOB_CHAT_MODE", pins.chatMode);
|
|
31048
|
-
return out;
|
|
31049
|
-
}
|
|
31050
|
-
var PROVIDERS = {
|
|
31051
|
-
anthropic: {
|
|
31052
|
-
id: "anthropic",
|
|
31053
|
-
displayName: "Anthropic",
|
|
31054
|
-
hostPattern: "api.anthropic.com",
|
|
31055
|
-
modes: [
|
|
31056
|
-
{
|
|
31057
|
-
key: "oauth",
|
|
31058
|
-
label: "OAuth Token",
|
|
31059
|
-
templateId: "anthropic-oauth",
|
|
31060
|
-
tokenPrefix: "sk-ant-oat",
|
|
31061
|
-
defaultEnvMappings: [
|
|
31062
|
-
{
|
|
31063
|
-
envName: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
31064
|
-
placeholder: DEFAULT_ENV_PLACEHOLDER
|
|
31065
|
-
}
|
|
31066
|
-
]
|
|
31067
|
-
},
|
|
31068
|
-
{
|
|
31069
|
-
key: "api-key",
|
|
31070
|
-
label: "API Key",
|
|
31071
|
-
templateId: "anthropic",
|
|
31072
|
-
tokenPrefix: "sk-ant-api",
|
|
31073
|
-
isDefault: true,
|
|
31074
|
-
defaultEnvMappings: [
|
|
31075
|
-
{
|
|
31076
|
-
envName: "ANTHROPIC_API_KEY",
|
|
31077
|
-
placeholder: DEFAULT_ENV_PLACEHOLDER
|
|
31078
|
-
}
|
|
31079
|
-
],
|
|
31080
|
-
injection: { headerName: "x-api-key", valueFormat: "{value}" }
|
|
31081
|
-
}
|
|
31082
|
-
]
|
|
31083
|
-
},
|
|
31084
|
-
"ibm-litellm": {
|
|
31085
|
-
id: "ibm-litellm",
|
|
31086
|
-
displayName: "IBM LiteLLM ETE Proxy",
|
|
31087
|
-
hostPattern: IBM_LITELLM_HOST,
|
|
31088
|
-
modes: [
|
|
31089
|
-
{
|
|
31090
|
-
key: "api-key",
|
|
31091
|
-
label: "API Token",
|
|
31092
|
-
templateId: "ibm-litellm",
|
|
31093
|
-
defaultEnvMappings: ibmLitellmEnvMappings()
|
|
31094
|
-
}
|
|
31095
|
-
]
|
|
31096
|
-
},
|
|
31097
|
-
openai: {
|
|
31098
|
-
id: "openai",
|
|
31099
|
-
displayName: "OpenAI",
|
|
31100
|
-
hostPattern: "api.openai.com",
|
|
31101
|
-
pathPattern: "/v1/*",
|
|
31102
|
-
modes: [
|
|
31103
|
-
{
|
|
31104
|
-
key: "api-key",
|
|
31105
|
-
label: "API Key",
|
|
31106
|
-
templateId: "openai",
|
|
31107
|
-
defaultEnvMappings: openaiEnvMappings()
|
|
31108
|
-
}
|
|
31109
|
-
]
|
|
31110
|
-
},
|
|
31111
|
-
bob: {
|
|
31112
|
-
id: "bob",
|
|
31113
|
-
displayName: "Bob Shell",
|
|
31114
|
-
hostPattern: BOB_HOST,
|
|
31115
|
-
modes: [
|
|
31116
|
-
{
|
|
31117
|
-
key: "api-key",
|
|
31118
|
-
label: "API Key",
|
|
31119
|
-
templateId: "bob",
|
|
31120
|
-
defaultEnvMappings: bobEnvMappings(),
|
|
31121
|
-
injection: {
|
|
31122
|
-
headerName: "Authorization",
|
|
31123
|
-
valueFormat: "Apikey {value}"
|
|
31124
|
-
},
|
|
31125
|
-
extraInjections: [
|
|
31126
|
-
{ headerName: "X-Bobshell-Internal", queryParamName: "key" }
|
|
31127
|
-
]
|
|
31128
|
-
}
|
|
31129
|
-
]
|
|
31130
|
-
}
|
|
31131
|
-
};
|
|
31132
|
-
var PROVIDER_PRESET_TYPES = Object.keys(
|
|
31133
|
-
PROVIDERS
|
|
31134
|
-
);
|
|
31135
|
-
var TEMPLATE_TO_PROVIDER = new Map(
|
|
31136
|
-
PROVIDER_PRESET_TYPES.flatMap(
|
|
31137
|
-
(type) => PROVIDERS[type].modes.map(
|
|
31138
|
-
(mode) => [mode.templateId, type]
|
|
31139
|
-
)
|
|
31140
|
-
)
|
|
31141
|
-
);
|
|
31142
|
-
var PROVIDER_TEMPLATE_IDS = new Set(
|
|
31143
|
-
TEMPLATE_TO_PROVIDER.keys()
|
|
31144
|
-
);
|
|
31145
|
-
function providerTypeForTemplateId(templateId) {
|
|
31146
|
-
return TEMPLATE_TO_PROVIDER.get(templateId) ?? null;
|
|
31147
|
-
}
|
|
31148
|
-
function templateIdForProvider(type, value) {
|
|
31149
|
-
const modes = PROVIDERS[type].modes;
|
|
31150
|
-
const matched = modes.find(
|
|
31151
|
-
(mode) => mode.tokenPrefix !== void 0 && value.startsWith(mode.tokenPrefix)
|
|
31152
|
-
);
|
|
31153
|
-
return (matched ?? modes.find((mode) => mode.isDefault) ?? modes[0]).templateId;
|
|
31154
|
-
}
|
|
31155
|
-
|
|
31156
31496
|
// ../api-server-api/src/modules/case-studies/constants.ts
|
|
31157
31497
|
var CASE_STUDY_CONTENT_MAX_CHARS = 262144;
|
|
31158
31498
|
var CASE_STUDY_SKILL_NAME = "agent-case-study";
|
|
@@ -31194,8 +31534,10 @@ var caseStudyInspectionFilterSchema = external_exports.object({
|
|
|
31194
31534
|
var METRICS_MAX_SINCE_HOURS = 720;
|
|
31195
31535
|
var METRICS_MAX_LIMIT = 1e3;
|
|
31196
31536
|
var METRICS_DEFAULT_LIMIT = 100;
|
|
31197
|
-
var
|
|
31198
|
-
var
|
|
31537
|
+
var AGENT_TELEMETRY_MAX_DAYS = 30;
|
|
31538
|
+
var AGENT_TELEMETRY_DEFAULT_DAYS = 7;
|
|
31539
|
+
var AGENT_TELEMETRY_MAX_LIMIT = 200;
|
|
31540
|
+
var AGENT_TELEMETRY_DEFAULT_LIMIT = 50;
|
|
31199
31541
|
|
|
31200
31542
|
// ../api-server-api/src/modules/metrics/schemas.ts
|
|
31201
31543
|
var metricsOverviewInputSchema = external_exports.object({
|
|
@@ -31204,9 +31546,22 @@ var metricsOverviewInputSchema = external_exports.object({
|
|
|
31204
31546
|
sinceHours: external_exports.coerce.number().int().positive().max(METRICS_MAX_SINCE_HOURS).optional(),
|
|
31205
31547
|
limit: external_exports.coerce.number().int().positive().max(METRICS_MAX_LIMIT).default(METRICS_DEFAULT_LIMIT)
|
|
31206
31548
|
});
|
|
31207
|
-
var
|
|
31208
|
-
days: external_exports.number().int().min(1).max(
|
|
31209
|
-
`Window length in days, counted back from now (default ${
|
|
31549
|
+
var agentTelemetryShape = {
|
|
31550
|
+
days: external_exports.number().int().min(1).max(AGENT_TELEMETRY_MAX_DAYS).default(AGENT_TELEMETRY_DEFAULT_DAYS).describe(
|
|
31551
|
+
`Window length in days, counted back from now (default ${AGENT_TELEMETRY_DEFAULT_DAYS}, max ${AGENT_TELEMETRY_MAX_DAYS}).`
|
|
31552
|
+
),
|
|
31553
|
+
sessionId: external_exports.string().min(1).optional().describe(
|
|
31554
|
+
"Narrow to a single session, including any harness run that session spawned. Omit to cover every session in the window."
|
|
31555
|
+
),
|
|
31556
|
+
limit: external_exports.number().int().positive().max(AGENT_TELEMETRY_MAX_LIMIT).default(AGENT_TELEMETRY_DEFAULT_LIMIT).describe(
|
|
31557
|
+
`Most rows to return, newest first (default ${AGENT_TELEMETRY_DEFAULT_LIMIT}, max ${AGENT_TELEMETRY_MAX_LIMIT}). Bounds the row list only; a result's own totalsCover states what its totals span.`
|
|
31558
|
+
)
|
|
31559
|
+
};
|
|
31560
|
+
var agentTelemetryInputSchema = external_exports.object(agentTelemetryShape);
|
|
31561
|
+
var agentMetricsInputSchema = external_exports.object({
|
|
31562
|
+
...agentTelemetryShape,
|
|
31563
|
+
granularity: external_exports.enum(["summary", "session", "call"]).default("summary").describe(
|
|
31564
|
+
"Detail level. 'summary': window totals and the per-model split. 'session': adds a row per session \u2014 calls, model time, tokens, cost, first/last activity. 'call': adds a row per LLM call \u2014 model, request latency, tokens, context size, cost."
|
|
31210
31565
|
)
|
|
31211
31566
|
});
|
|
31212
31567
|
var metricsSpendInputSchema = external_exports.object({
|
|
@@ -31365,11 +31720,16 @@ var templateInput = external_exports.object({
|
|
|
31365
31720
|
patternHint: external_exports.string().optional(),
|
|
31366
31721
|
enumValues: external_exports.array(external_exports.string()).optional()
|
|
31367
31722
|
});
|
|
31723
|
+
var connectionFamilyView = external_exports.object({
|
|
31724
|
+
id: external_exports.string(),
|
|
31725
|
+
title: external_exports.string()
|
|
31726
|
+
});
|
|
31368
31727
|
var connectionTemplateView = external_exports.object({
|
|
31369
31728
|
id: external_exports.string(),
|
|
31370
31729
|
name: external_exports.string(),
|
|
31371
31730
|
category: connectionCategory,
|
|
31372
31731
|
isCustom: external_exports.boolean(),
|
|
31732
|
+
family: connectionFamilyView.optional(),
|
|
31373
31733
|
description: external_exports.string().optional(),
|
|
31374
31734
|
iconSlug: external_exports.string().optional(),
|
|
31375
31735
|
authKind,
|
|
@@ -31521,6 +31881,16 @@ var SessionMode = /* @__PURE__ */ ((SessionMode2) => {
|
|
|
31521
31881
|
})(SessionMode || {});
|
|
31522
31882
|
var sessionModeSchema = external_exports.enum(SessionMode);
|
|
31523
31883
|
|
|
31884
|
+
// ../api-server-api/src/modules/attention/schemas.ts
|
|
31885
|
+
var attentionDismissInputSchema = external_exports.object({
|
|
31886
|
+
items: external_exports.array(
|
|
31887
|
+
external_exports.object({
|
|
31888
|
+
kind: external_exports.enum(["session", "approval"]),
|
|
31889
|
+
id: external_exports.string().trim().min(1).max(512)
|
|
31890
|
+
})
|
|
31891
|
+
).min(1).max(200)
|
|
31892
|
+
});
|
|
31893
|
+
|
|
31524
31894
|
// ../api-server-api/src/modules/terminal/protocol.ts
|
|
31525
31895
|
var OP_INPUT = 0;
|
|
31526
31896
|
var OP_OUTPUT = 1;
|
|
@@ -31680,6 +32050,11 @@ var platformTurnEndedNotificationSchema = external_exports.object({
|
|
|
31680
32050
|
method: external_exports.literal("platform/turnEnded"),
|
|
31681
32051
|
params: platformTurnEndedParamsSchema
|
|
31682
32052
|
});
|
|
32053
|
+
var platformFrameMetaSchema = external_exports.object({
|
|
32054
|
+
at: external_exports.string().datetime({ offset: true }).optional(),
|
|
32055
|
+
replayFor: external_exports.string().min(1).optional(),
|
|
32056
|
+
telemetryPromptId: external_exports.string().min(1).optional()
|
|
32057
|
+
});
|
|
31683
32058
|
var platformClippedReplayMetaSchema = external_exports.object({
|
|
31684
32059
|
older: external_exports.string().min(1).optional()
|
|
31685
32060
|
});
|
|
@@ -31734,8 +32109,21 @@ var platformRunResultSchema = external_exports.object({
|
|
|
31734
32109
|
var platformRunResultResponseSchema = external_exports.discriminatedUnion("status", [
|
|
31735
32110
|
external_exports.object({ status: external_exports.literal("done"), result: platformRunResultSchema }),
|
|
31736
32111
|
external_exports.object({ status: external_exports.literal("pending") }),
|
|
32112
|
+
external_exports.object({ status: external_exports.literal("interrupted") }),
|
|
31737
32113
|
external_exports.object({ status: external_exports.literal("none") })
|
|
31738
32114
|
]);
|
|
32115
|
+
var platformRunStartsMetaSchema = external_exports.array(
|
|
32116
|
+
external_exports.string().datetime({ offset: true })
|
|
32117
|
+
);
|
|
32118
|
+
var platformRunStartedParamsSchema = external_exports.object({
|
|
32119
|
+
sessionId: external_exports.string().min(1),
|
|
32120
|
+
at: external_exports.string().datetime({ offset: true })
|
|
32121
|
+
});
|
|
32122
|
+
var platformRunStartedNotificationSchema = external_exports.object({
|
|
32123
|
+
jsonrpc: external_exports.literal("2.0"),
|
|
32124
|
+
method: external_exports.literal("platform/runStarted"),
|
|
32125
|
+
params: platformRunStartedParamsSchema
|
|
32126
|
+
});
|
|
31739
32127
|
var platformPromptStartedParamsSchema = external_exports.object({
|
|
31740
32128
|
sessionId: external_exports.string().min(1),
|
|
31741
32129
|
promptId: external_exports.string().min(1)
|
|
@@ -31809,7 +32197,8 @@ var termsLatestAcceptanceSchema = external_exports.object({
|
|
|
31809
32197
|
var entryPointChoiceSchema = external_exports.enum([
|
|
31810
32198
|
"sandbox",
|
|
31811
32199
|
"experiment",
|
|
31812
|
-
"knowledge-base"
|
|
32200
|
+
"knowledge-base",
|
|
32201
|
+
"starter-kit"
|
|
31813
32202
|
]);
|
|
31814
32203
|
var entryPointChosenInputSchema = external_exports.object({
|
|
31815
32204
|
choice: entryPointChoiceSchema
|
|
@@ -31889,9 +32278,23 @@ var slackFireCommandInputSchema = external_exports.object({
|
|
|
31889
32278
|
channelId: external_exports.string().min(1)
|
|
31890
32279
|
}).strict();
|
|
31891
32280
|
var slackFireCommandResultSchema = external_exports.object({ ack: external_exports.string() }).strict();
|
|
32281
|
+
var slackConnectWorkspaceInputSchema = external_exports.object({
|
|
32282
|
+
teamId: external_exports.string().min(1),
|
|
32283
|
+
teamName: external_exports.string().optional(),
|
|
32284
|
+
botToken: external_exports.string().min(1),
|
|
32285
|
+
channels: external_exports.array(
|
|
32286
|
+
external_exports.object({
|
|
32287
|
+
id: external_exports.string().min(1),
|
|
32288
|
+
name: external_exports.string().min(1),
|
|
32289
|
+
botIsMember: external_exports.boolean()
|
|
32290
|
+
}).strict()
|
|
32291
|
+
)
|
|
32292
|
+
}).strict();
|
|
32293
|
+
var slackConnectWorkspaceResultSchema = external_exports.object({ ok: external_exports.literal(true), secretPath: external_exports.string() }).strict();
|
|
31892
32294
|
var slackOutboundRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
31893
32295
|
external_exports.object({
|
|
31894
32296
|
kind: external_exports.literal("message"),
|
|
32297
|
+
teamId: external_exports.string(),
|
|
31895
32298
|
channel: external_exports.string(),
|
|
31896
32299
|
text: external_exports.string(),
|
|
31897
32300
|
threadTs: external_exports.string().optional(),
|
|
@@ -31899,6 +32302,7 @@ var slackOutboundRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
|
31899
32302
|
}).strict(),
|
|
31900
32303
|
external_exports.object({
|
|
31901
32304
|
kind: external_exports.literal("ephemeral"),
|
|
32305
|
+
teamId: external_exports.string(),
|
|
31902
32306
|
channel: external_exports.string(),
|
|
31903
32307
|
user: external_exports.string(),
|
|
31904
32308
|
text: external_exports.string(),
|
|
@@ -31906,18 +32310,21 @@ var slackOutboundRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
|
31906
32310
|
}).strict(),
|
|
31907
32311
|
external_exports.object({
|
|
31908
32312
|
kind: external_exports.literal("reaction"),
|
|
32313
|
+
teamId: external_exports.string(),
|
|
31909
32314
|
channel: external_exports.string(),
|
|
31910
32315
|
ts: external_exports.string(),
|
|
31911
32316
|
name: external_exports.string()
|
|
31912
32317
|
}).strict(),
|
|
31913
32318
|
external_exports.object({
|
|
31914
32319
|
kind: external_exports.literal("upload"),
|
|
32320
|
+
teamId: external_exports.string(),
|
|
31915
32321
|
channelId: external_exports.string(),
|
|
31916
32322
|
filename: external_exports.string(),
|
|
31917
32323
|
threadTs: external_exports.string().optional()
|
|
31918
32324
|
}).strict(),
|
|
31919
32325
|
external_exports.object({
|
|
31920
32326
|
kind: external_exports.literal("stream_start"),
|
|
32327
|
+
teamId: external_exports.string(),
|
|
31921
32328
|
channel: external_exports.string(),
|
|
31922
32329
|
threadTs: external_exports.string(),
|
|
31923
32330
|
ts: external_exports.string(),
|
|
@@ -31927,18 +32334,21 @@ var slackOutboundRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
|
31927
32334
|
}).strict(),
|
|
31928
32335
|
external_exports.object({
|
|
31929
32336
|
kind: external_exports.literal("stream_append"),
|
|
32337
|
+
teamId: external_exports.string(),
|
|
31930
32338
|
channel: external_exports.string(),
|
|
31931
32339
|
ts: external_exports.string(),
|
|
31932
32340
|
text: external_exports.string()
|
|
31933
32341
|
}).strict(),
|
|
31934
32342
|
external_exports.object({
|
|
31935
32343
|
kind: external_exports.literal("stream_stop"),
|
|
32344
|
+
teamId: external_exports.string(),
|
|
31936
32345
|
channel: external_exports.string(),
|
|
31937
32346
|
ts: external_exports.string(),
|
|
31938
32347
|
text: external_exports.string().optional()
|
|
31939
32348
|
}).strict(),
|
|
31940
32349
|
external_exports.object({
|
|
31941
32350
|
kind: external_exports.literal("status"),
|
|
32351
|
+
teamId: external_exports.string(),
|
|
31942
32352
|
channel: external_exports.string(),
|
|
31943
32353
|
threadTs: external_exports.string(),
|
|
31944
32354
|
status: external_exports.string()
|
|
@@ -32010,6 +32420,62 @@ var kbPublishCompleteInputSchema = external_exports.object({
|
|
|
32010
32420
|
})
|
|
32011
32421
|
});
|
|
32012
32422
|
|
|
32423
|
+
// ../api-server-api/src/modules/telemetry/constants.ts
|
|
32424
|
+
var TELEMETRY_MAX_SINCE_HOURS = 720;
|
|
32425
|
+
var TELEMETRY_DEFAULT_SINCE_HOURS = 24;
|
|
32426
|
+
var TELEMETRY_MAX_TURNS = 500;
|
|
32427
|
+
var TELEMETRY_DEFAULT_TURNS = 100;
|
|
32428
|
+
var TELEMETRY_MAX_SPANS = 2e3;
|
|
32429
|
+
var TELEMETRY_DEFAULT_SPANS = 1e3;
|
|
32430
|
+
var TELEMETRY_MAX_LOGS = 2e3;
|
|
32431
|
+
var TELEMETRY_DEFAULT_LOGS = 1e3;
|
|
32432
|
+
var TELEMETRY_MAX_LOG_ROWS = 1e3;
|
|
32433
|
+
var TELEMETRY_DEFAULT_LOG_ROWS = 200;
|
|
32434
|
+
var TELEMETRY_MAX_TRACE_HOURS = 6;
|
|
32435
|
+
|
|
32436
|
+
// ../api-server-api/src/modules/telemetry/schemas.ts
|
|
32437
|
+
var traceId = external_exports.string().min(1).max(64).regex(/^[0-9a-fA-F]+$/, { message: "traceId must be hexadecimal" });
|
|
32438
|
+
var sinceHours = external_exports.coerce.number().int().positive().max(TELEMETRY_MAX_SINCE_HOURS).default(TELEMETRY_DEFAULT_SINCE_HOURS);
|
|
32439
|
+
var telemetryTurnsInputSchema = external_exports.object({
|
|
32440
|
+
agentId: external_exports.string().min(1),
|
|
32441
|
+
sessionId: external_exports.string().min(1),
|
|
32442
|
+
sinceHours,
|
|
32443
|
+
limit: external_exports.coerce.number().int().positive().max(TELEMETRY_MAX_TURNS).default(TELEMETRY_DEFAULT_TURNS),
|
|
32444
|
+
spanLimit: external_exports.coerce.number().int().positive().max(TELEMETRY_MAX_SPANS).default(TELEMETRY_DEFAULT_SPANS),
|
|
32445
|
+
logLimit: external_exports.coerce.number().int().positive().max(TELEMETRY_MAX_LOGS).default(TELEMETRY_DEFAULT_LOGS)
|
|
32446
|
+
});
|
|
32447
|
+
var telemetryTurnInputSchema = external_exports.object({
|
|
32448
|
+
agentId: external_exports.string().min(1),
|
|
32449
|
+
sessionId: external_exports.string().min(1),
|
|
32450
|
+
promptId: external_exports.string().min(1).max(200).optional(),
|
|
32451
|
+
from: external_exports.string().datetime(),
|
|
32452
|
+
to: external_exports.string().datetime(),
|
|
32453
|
+
spanLimit: external_exports.coerce.number().int().positive().max(TELEMETRY_MAX_SPANS).default(TELEMETRY_DEFAULT_SPANS),
|
|
32454
|
+
logLimit: external_exports.coerce.number().int().positive().max(TELEMETRY_MAX_LOGS).default(TELEMETRY_DEFAULT_LOGS)
|
|
32455
|
+
}).refine(
|
|
32456
|
+
(q2) => Date.parse(q2.to) - Date.parse(q2.from) <= TELEMETRY_MAX_TRACE_HOURS * 36e5,
|
|
32457
|
+
{
|
|
32458
|
+
message: `a turn window may not exceed ${TELEMETRY_MAX_TRACE_HOURS} hours`,
|
|
32459
|
+
path: ["to"]
|
|
32460
|
+
}
|
|
32461
|
+
);
|
|
32462
|
+
var telemetryLogsInputSchema = external_exports.object({
|
|
32463
|
+
agentId: external_exports.string().min(1).optional(),
|
|
32464
|
+
sessionId: external_exports.string().min(1).optional(),
|
|
32465
|
+
traceId: traceId.optional(),
|
|
32466
|
+
event: external_exports.string().min(1).max(200).optional(),
|
|
32467
|
+
contains: external_exports.string().min(1).max(200).optional(),
|
|
32468
|
+
sinceHours,
|
|
32469
|
+
limit: external_exports.coerce.number().int().positive().max(TELEMETRY_MAX_LOG_ROWS).default(TELEMETRY_DEFAULT_LOG_ROWS)
|
|
32470
|
+
});
|
|
32471
|
+
var telemetryExportSignalSchema = external_exports.enum(["spans", "logs"]);
|
|
32472
|
+
var telemetryExportQuerySchema = external_exports.object({
|
|
32473
|
+
agentId: external_exports.string().min(1).optional(),
|
|
32474
|
+
sessionId: external_exports.string().min(1).optional(),
|
|
32475
|
+
signal: telemetryExportSignalSchema.default("logs"),
|
|
32476
|
+
sinceHours
|
|
32477
|
+
});
|
|
32478
|
+
|
|
32013
32479
|
// src/result.ts
|
|
32014
32480
|
var ok2 = (value) => ({ ok: true, value });
|
|
32015
32481
|
var err2 = (error51) => ({ ok: false, error: error51 });
|
|
@@ -32042,6 +32508,129 @@ async function trpcCall(fn) {
|
|
|
32042
32508
|
}
|
|
32043
32509
|
}
|
|
32044
32510
|
|
|
32511
|
+
// src/modules/connection/services/connection-service.ts
|
|
32512
|
+
function createConnectionService(deps) {
|
|
32513
|
+
const readIds = async (agentId) => {
|
|
32514
|
+
const res = await deps.trpc.connections.getAgentConnections.query({
|
|
32515
|
+
agentId
|
|
32516
|
+
});
|
|
32517
|
+
return res.connections.map((c2) => c2.connectionId);
|
|
32518
|
+
};
|
|
32519
|
+
return {
|
|
32520
|
+
async list() {
|
|
32521
|
+
return trpcCall(() => deps.trpc.connections.list.query());
|
|
32522
|
+
},
|
|
32523
|
+
async listTemplates() {
|
|
32524
|
+
return trpcCall(() => deps.trpc.connections.listTemplates.query());
|
|
32525
|
+
},
|
|
32526
|
+
async createConnection(input) {
|
|
32527
|
+
return trpcCall(() => deps.trpc.connections.create.mutate(input));
|
|
32528
|
+
},
|
|
32529
|
+
async update(id, value) {
|
|
32530
|
+
return trpcCall(async () => {
|
|
32531
|
+
await deps.trpc.connections.update.mutate({ id, value });
|
|
32532
|
+
});
|
|
32533
|
+
},
|
|
32534
|
+
async startOAuth(connectionId) {
|
|
32535
|
+
return trpcCall(
|
|
32536
|
+
() => deps.trpc.connections.startOAuth.mutate({ connectionId })
|
|
32537
|
+
);
|
|
32538
|
+
},
|
|
32539
|
+
async discoverMcp(url2) {
|
|
32540
|
+
return trpcCall(() => deps.trpc.connections.discoverMcp.mutate({ url: url2 }));
|
|
32541
|
+
},
|
|
32542
|
+
async probeClusterCa(host) {
|
|
32543
|
+
return trpcCall(
|
|
32544
|
+
() => deps.trpc.connections.probeClusterCa.mutate({ host })
|
|
32545
|
+
);
|
|
32546
|
+
},
|
|
32547
|
+
async getConnection(id) {
|
|
32548
|
+
return trpcCall(() => deps.trpc.connections.get.query({ id }));
|
|
32549
|
+
},
|
|
32550
|
+
async agentConnectionIds(agentId) {
|
|
32551
|
+
return trpcCall(() => readIds(agentId));
|
|
32552
|
+
},
|
|
32553
|
+
async grant(agentId, add) {
|
|
32554
|
+
return trpcCall(async () => {
|
|
32555
|
+
const current = await readIds(agentId);
|
|
32556
|
+
const next = Array.from(/* @__PURE__ */ new Set([...current, ...add]));
|
|
32557
|
+
await deps.trpc.connections.setAgentConnections.mutate({
|
|
32558
|
+
agentId,
|
|
32559
|
+
connectionIds: next
|
|
32560
|
+
});
|
|
32561
|
+
return next;
|
|
32562
|
+
});
|
|
32563
|
+
},
|
|
32564
|
+
async revoke(agentId, remove) {
|
|
32565
|
+
return trpcCall(async () => {
|
|
32566
|
+
const drop = new Set(remove);
|
|
32567
|
+
const current = await readIds(agentId);
|
|
32568
|
+
const next = current.filter((id) => !drop.has(id));
|
|
32569
|
+
await deps.trpc.connections.setAgentConnections.mutate({
|
|
32570
|
+
agentId,
|
|
32571
|
+
connectionIds: next
|
|
32572
|
+
});
|
|
32573
|
+
return next;
|
|
32574
|
+
});
|
|
32575
|
+
},
|
|
32576
|
+
async disconnect(id) {
|
|
32577
|
+
return trpcCall(async () => {
|
|
32578
|
+
await deps.trpc.connections.delete.mutate({ id });
|
|
32579
|
+
});
|
|
32580
|
+
}
|
|
32581
|
+
};
|
|
32582
|
+
}
|
|
32583
|
+
|
|
32584
|
+
// src/modules/connection/domain/config-inputs.ts
|
|
32585
|
+
function configInputsOf(template) {
|
|
32586
|
+
return template.inputs.filter((i) => i.configInput);
|
|
32587
|
+
}
|
|
32588
|
+
function validateConfigInputValue(input, value) {
|
|
32589
|
+
const trimmed = value.trim();
|
|
32590
|
+
if (trimmed === "") return void 0;
|
|
32591
|
+
const label = input.label ?? input.name;
|
|
32592
|
+
if (input.enumValues && !input.enumValues.includes(trimmed)) {
|
|
32593
|
+
const opts = input.enumValues.map((v2) => `\`${v2}\``).join(", ");
|
|
32594
|
+
return `${label}: must be one of ${opts}`;
|
|
32595
|
+
}
|
|
32596
|
+
if (input.pattern && !new RegExp(`^(?:${input.pattern})$`).test(trimmed)) {
|
|
32597
|
+
const expected = input.patternHint ?? `value matching ${input.pattern}`;
|
|
32598
|
+
return `${label}: expected ${expected}`;
|
|
32599
|
+
}
|
|
32600
|
+
return void 0;
|
|
32601
|
+
}
|
|
32602
|
+
function resolveConfigInputFlags(template, rawFlags) {
|
|
32603
|
+
const byName2 = new Map(configInputsOf(template).map((i) => [i.name, i]));
|
|
32604
|
+
const out = {};
|
|
32605
|
+
for (const raw of rawFlags) {
|
|
32606
|
+
const eq = raw.indexOf("=");
|
|
32607
|
+
if (eq < 0) return err2({ kind: "missing-equals", input: raw });
|
|
32608
|
+
const key = raw.slice(0, eq);
|
|
32609
|
+
const value = raw.slice(eq + 1).trim();
|
|
32610
|
+
const input = byName2.get(key);
|
|
32611
|
+
if (!input) {
|
|
32612
|
+
return err2({ kind: "unknown-key", key, validKeys: [...byName2.keys()] });
|
|
32613
|
+
}
|
|
32614
|
+
if (value === "") {
|
|
32615
|
+
delete out[key];
|
|
32616
|
+
continue;
|
|
32617
|
+
}
|
|
32618
|
+
const message = validateConfigInputValue(input, value);
|
|
32619
|
+
if (message) return err2({ kind: "invalid-value", key, message });
|
|
32620
|
+
out[key] = value;
|
|
32621
|
+
}
|
|
32622
|
+
return ok2(out);
|
|
32623
|
+
}
|
|
32624
|
+
|
|
32625
|
+
// src/modules/connection/domain/connection-ref.ts
|
|
32626
|
+
var CONNECTION_ID_PREFIX = "conn-";
|
|
32627
|
+
function resolveConnectionRef(connections, ref) {
|
|
32628
|
+
if (ref.startsWith(CONNECTION_ID_PREFIX)) {
|
|
32629
|
+
return connections.find((c2) => c2.id === ref) ?? null;
|
|
32630
|
+
}
|
|
32631
|
+
return connections.find((c2) => c2.name === ref) ?? null;
|
|
32632
|
+
}
|
|
32633
|
+
|
|
32045
32634
|
// src/modules/shared/format-zod-error.ts
|
|
32046
32635
|
function formatZodError(err3) {
|
|
32047
32636
|
return err3.issues.map((issue2) => {
|
|
@@ -32276,7 +32865,6 @@ function printTrpcError(e2, host) {
|
|
|
32276
32865
|
}
|
|
32277
32866
|
|
|
32278
32867
|
// src/modules/agent/commands/create-helpers.ts
|
|
32279
|
-
var RESERVED_AGENT_PREFIX = "agent-";
|
|
32280
32868
|
function parseEnvFlag(values) {
|
|
32281
32869
|
const map3 = /* @__PURE__ */ new Map();
|
|
32282
32870
|
const duplicates = /* @__PURE__ */ new Set();
|
|
@@ -32296,7 +32884,7 @@ function parseEnvFlag(values) {
|
|
|
32296
32884
|
}
|
|
32297
32885
|
function validateAgentName(name) {
|
|
32298
32886
|
if (name.length === 0) return err2("empty");
|
|
32299
|
-
if (
|
|
32887
|
+
if (AGENT_ID_RE.test(name)) return err2("id-shape");
|
|
32300
32888
|
return ok2(void 0);
|
|
32301
32889
|
}
|
|
32302
32890
|
|
|
@@ -32319,13 +32907,19 @@ var EXIT_SIGINT = 130;
|
|
|
32319
32907
|
// src/modules/agent/commands/create.ts
|
|
32320
32908
|
var DEFAULT_TIMEOUT_SECONDS = 120;
|
|
32321
32909
|
function buildCreateCommand(deps) {
|
|
32322
|
-
return new Command("create").description("Create a new Agent from a template on the active host").argument(
|
|
32910
|
+
return new Command("create").description("Create a new Agent from a template on the active host").argument(
|
|
32911
|
+
"<name>",
|
|
32912
|
+
"Agent name (1+ chars; not `agent-` plus 16 hex characters, the shape of an ID)"
|
|
32913
|
+
).option(
|
|
32323
32914
|
"--server <url>",
|
|
32324
32915
|
"override the configured server URL for this call"
|
|
32325
32916
|
).option(
|
|
32326
32917
|
"--template <id>",
|
|
32327
32918
|
"template id (required; see `dam template list`)"
|
|
32328
32919
|
).option("--description <text>", "free-form description").option(
|
|
32920
|
+
"--provider <id-or-name>",
|
|
32921
|
+
"model-provider connection id or unique name (required; see `dam connection list`)"
|
|
32922
|
+
).option(
|
|
32329
32923
|
"--env <KEY=VAL>",
|
|
32330
32924
|
"env var, repeatable",
|
|
32331
32925
|
(val, prev) => [...prev, val],
|
|
@@ -32338,9 +32932,9 @@ function buildCreateCommand(deps) {
|
|
|
32338
32932
|
[
|
|
32339
32933
|
"",
|
|
32340
32934
|
"Examples:",
|
|
32341
|
-
" dam agent create my-agent --template claude-code",
|
|
32342
|
-
|
|
32343
|
-
' dam agent create my-agent --template pi-agent --
|
|
32935
|
+
" dam agent create my-agent --template claude-code --provider conn-123",
|
|
32936
|
+
' dam agent create my-agent --template claude-code --provider "My provider" --wait',
|
|
32937
|
+
' dam agent create my-agent --template pi-agent --provider conn-123 --description "Coding helper"',
|
|
32344
32938
|
""
|
|
32345
32939
|
].join("\n")
|
|
32346
32940
|
).action(
|
|
@@ -32352,9 +32946,9 @@ function buildCreateCommand(deps) {
|
|
|
32352
32946
|
async function runCreate(name, opts, deps) {
|
|
32353
32947
|
const nameCheck = validateAgentName(name);
|
|
32354
32948
|
if (!nameCheck.ok) {
|
|
32355
|
-
if (nameCheck.error === "
|
|
32949
|
+
if (nameCheck.error === "id-shape") {
|
|
32356
32950
|
process.stderr.write(
|
|
32357
|
-
`error: agent name \`${name}\`
|
|
32951
|
+
`error: agent name \`${name}\` has the shape of an agent ID (\`agent-\` and 16 hex characters)
|
|
32358
32952
|
`
|
|
32359
32953
|
);
|
|
32360
32954
|
} else {
|
|
@@ -32369,6 +32963,12 @@ async function runCreate(name, opts, deps) {
|
|
|
32369
32963
|
process.exit(EXIT_INVALID_INPUT);
|
|
32370
32964
|
}
|
|
32371
32965
|
const template = opts.template;
|
|
32966
|
+
if (!opts.provider) {
|
|
32967
|
+
process.stderr.write(
|
|
32968
|
+
"error: `--provider <id-or-name>` is required; run `dam connection list` to choose a model provider, or `dam agent create-interactive` to add one\n"
|
|
32969
|
+
);
|
|
32970
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
32971
|
+
}
|
|
32372
32972
|
const envResult = parseEnvFlag(opts.env ?? []);
|
|
32373
32973
|
if (!envResult.ok) {
|
|
32374
32974
|
if (envResult.error.kind === "missing-equals") {
|
|
@@ -32411,8 +33011,8 @@ async function runCreate(name, opts, deps) {
|
|
|
32411
33011
|
printServiceError(tmplResult.error, host);
|
|
32412
33012
|
process.exit(EXIT_RUNTIME_FAILURE);
|
|
32413
33013
|
}
|
|
32414
|
-
const
|
|
32415
|
-
if (!
|
|
33014
|
+
const selectedTemplate = tmplResult.value.find((t) => t.id === template);
|
|
33015
|
+
if (!selectedTemplate) {
|
|
32416
33016
|
process.stderr.write(
|
|
32417
33017
|
`error: unknown template \`${template}\`; available: ${tmplResult.value.map((t) => t.id).join(", ") || "(none)"}
|
|
32418
33018
|
`
|
|
@@ -32420,11 +33020,36 @@ async function runCreate(name, opts, deps) {
|
|
|
32420
33020
|
process.exit(EXIT_INVALID_INPUT);
|
|
32421
33021
|
}
|
|
32422
33022
|
const trpc = deps.createTrpcClient(host);
|
|
33023
|
+
let providerConnectionId = opts.provider;
|
|
33024
|
+
if (!providerConnectionId.startsWith(CONNECTION_ID_PREFIX)) {
|
|
33025
|
+
const connections = await trpcCall(() => trpc.connections.list.query());
|
|
33026
|
+
if (!connections.ok) {
|
|
33027
|
+
printServiceError(connections.error, host);
|
|
33028
|
+
process.stderr.write(
|
|
33029
|
+
"hint: provider name lookup requires credentials:read; pass --provider <connection-id> to create with agents:manage alone\n"
|
|
33030
|
+
);
|
|
33031
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
33032
|
+
}
|
|
33033
|
+
const matches = connections.value.filter(
|
|
33034
|
+
(connection2) => PROVIDER_TEMPLATE_IDS.has(connection2.templateId) && connection2.name === opts.provider
|
|
33035
|
+
);
|
|
33036
|
+
if (matches.length !== 1) {
|
|
33037
|
+
process.stderr.write(
|
|
33038
|
+
matches.length === 0 ? `error: no model-provider connection matches '${opts.provider}'; run \`dam connection list\` to choose a provider, or \`dam agent create-interactive\` to add one
|
|
33039
|
+
` : `error: multiple model-provider connections are named '${opts.provider}'; pass a connection id from \`dam connection list\`
|
|
33040
|
+
`
|
|
33041
|
+
);
|
|
33042
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
33043
|
+
}
|
|
33044
|
+
providerConnectionId = matches[0].id;
|
|
33045
|
+
}
|
|
32423
33046
|
const createInput = await parseOrExit(
|
|
32424
33047
|
agentCreateInputSchema,
|
|
32425
33048
|
{
|
|
32426
33049
|
name,
|
|
32427
33050
|
templateId: template,
|
|
33051
|
+
connectionIds: [providerConnectionId],
|
|
33052
|
+
providerConnectionId,
|
|
32428
33053
|
description: opts.description,
|
|
32429
33054
|
env: env.length > 0 ? env : void 0
|
|
32430
33055
|
},
|
|
@@ -32434,6 +33059,13 @@ async function runCreate(name, opts, deps) {
|
|
|
32434
33059
|
try {
|
|
32435
33060
|
agent = await trpc.agents.create.mutate(createInput);
|
|
32436
33061
|
} catch (e2) {
|
|
33062
|
+
if (e2?.data?.code === "BAD_REQUEST") {
|
|
33063
|
+
process.stderr.write(
|
|
33064
|
+
`error: failed to create agent: ${errorReason(e2)}
|
|
33065
|
+
`
|
|
33066
|
+
);
|
|
33067
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
33068
|
+
}
|
|
32437
33069
|
if (e2?.data?.code === "NOT_FOUND") {
|
|
32438
33070
|
process.stderr.write(
|
|
32439
33071
|
`error: template \`${template}\` was deleted while creating; retry
|
|
@@ -33460,158 +34092,44 @@ ${a}
|
|
|
33460
34092
|
};
|
|
33461
34093
|
var jt = `${e("gray", $)} `;
|
|
33462
34094
|
var Re = (t) => new ht({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, output: t.output, signal: t.signal, input: t.input, render() {
|
|
33463
|
-
const r = t?.withGuide ?? h.withGuide, s = `${`${r ? `${e("gray", $)}
|
|
33464
|
-
` : ""}${M(this.state)} `}${t.message}
|
|
33465
|
-
`, i = t.placeholder ? e("inverse", t.placeholder[0]) + e("dim", t.placeholder.slice(1)) : e(["inverse", "hidden"], "_"), u = this.userInput ? this.userInputWithCursor : i, n = this.value ?? "";
|
|
33466
|
-
switch (this.state) {
|
|
33467
|
-
case "error": {
|
|
33468
|
-
const o = this.error ? ` ${e("yellow", this.error)}` : "", c2 = r ? `${e("yellow", $)} ` : "", a = r ? e("yellow", E2) : "";
|
|
33469
|
-
return `${s.trim()}
|
|
33470
|
-
${c2}${u}
|
|
33471
|
-
${a}${o}
|
|
33472
|
-
`;
|
|
33473
|
-
}
|
|
33474
|
-
case "submit": {
|
|
33475
|
-
const o = n ? ` ${e("dim", n)}` : "", c2 = r ? e("gray", $) : "";
|
|
33476
|
-
return `${s}${c2}${o}`;
|
|
33477
|
-
}
|
|
33478
|
-
case "cancel": {
|
|
33479
|
-
const o = n ? ` ${e(["strikethrough", "dim"], n)}` : "", c2 = r ? e("gray", $) : "";
|
|
33480
|
-
return `${s}${c2}${o}${n.trim() ? `
|
|
33481
|
-
${c2}` : ""}`;
|
|
33482
|
-
}
|
|
33483
|
-
default: {
|
|
33484
|
-
const o = r ? `${e("cyan", $)} ` : "", c2 = r ? e("cyan", E2) : "";
|
|
33485
|
-
return `${s}${o}${u}
|
|
33486
|
-
${c2}
|
|
33487
|
-
`;
|
|
33488
|
-
}
|
|
33489
|
-
}
|
|
33490
|
-
} }).prompt();
|
|
33491
|
-
|
|
33492
|
-
// src/modules/shared/prompt-secret.ts
|
|
33493
|
-
function promptSecret(message) {
|
|
33494
|
-
return Ce({
|
|
33495
|
-
message,
|
|
33496
|
-
validate(v2) {
|
|
33497
|
-
if (!v2 || v2.trim() === "") return "Required";
|
|
33498
|
-
return void 0;
|
|
33499
|
-
}
|
|
33500
|
-
});
|
|
33501
|
-
}
|
|
33502
|
-
|
|
33503
|
-
// src/modules/connection/services/connection-service.ts
|
|
33504
|
-
function createConnectionService(deps) {
|
|
33505
|
-
const readIds = async (agentId) => {
|
|
33506
|
-
const res = await deps.trpc.connections.getAgentConnections.query({
|
|
33507
|
-
agentId
|
|
33508
|
-
});
|
|
33509
|
-
return res.connections.map((c2) => c2.connectionId);
|
|
33510
|
-
};
|
|
33511
|
-
return {
|
|
33512
|
-
async list() {
|
|
33513
|
-
return trpcCall(() => deps.trpc.connections.list.query());
|
|
33514
|
-
},
|
|
33515
|
-
async listTemplates() {
|
|
33516
|
-
return trpcCall(() => deps.trpc.connections.listTemplates.query());
|
|
33517
|
-
},
|
|
33518
|
-
async createConnection(input) {
|
|
33519
|
-
return trpcCall(() => deps.trpc.connections.create.mutate(input));
|
|
33520
|
-
},
|
|
33521
|
-
async update(id, value) {
|
|
33522
|
-
return trpcCall(async () => {
|
|
33523
|
-
await deps.trpc.connections.update.mutate({ id, value });
|
|
33524
|
-
});
|
|
33525
|
-
},
|
|
33526
|
-
async startOAuth(connectionId) {
|
|
33527
|
-
return trpcCall(
|
|
33528
|
-
() => deps.trpc.connections.startOAuth.mutate({ connectionId })
|
|
33529
|
-
);
|
|
33530
|
-
},
|
|
33531
|
-
async discoverMcp(url2) {
|
|
33532
|
-
return trpcCall(() => deps.trpc.connections.discoverMcp.mutate({ url: url2 }));
|
|
33533
|
-
},
|
|
33534
|
-
async probeClusterCa(host) {
|
|
33535
|
-
return trpcCall(
|
|
33536
|
-
() => deps.trpc.connections.probeClusterCa.mutate({ host })
|
|
33537
|
-
);
|
|
33538
|
-
},
|
|
33539
|
-
async getConnection(id) {
|
|
33540
|
-
return trpcCall(() => deps.trpc.connections.get.query({ id }));
|
|
33541
|
-
},
|
|
33542
|
-
async agentConnectionIds(agentId) {
|
|
33543
|
-
return trpcCall(() => readIds(agentId));
|
|
33544
|
-
},
|
|
33545
|
-
async grant(agentId, add) {
|
|
33546
|
-
return trpcCall(async () => {
|
|
33547
|
-
const current = await readIds(agentId);
|
|
33548
|
-
const next = Array.from(/* @__PURE__ */ new Set([...current, ...add]));
|
|
33549
|
-
await deps.trpc.connections.setAgentConnections.mutate({
|
|
33550
|
-
agentId,
|
|
33551
|
-
connectionIds: next
|
|
33552
|
-
});
|
|
33553
|
-
return next;
|
|
33554
|
-
});
|
|
33555
|
-
},
|
|
33556
|
-
async revoke(agentId, remove) {
|
|
33557
|
-
return trpcCall(async () => {
|
|
33558
|
-
const drop = new Set(remove);
|
|
33559
|
-
const current = await readIds(agentId);
|
|
33560
|
-
const next = current.filter((id) => !drop.has(id));
|
|
33561
|
-
await deps.trpc.connections.setAgentConnections.mutate({
|
|
33562
|
-
agentId,
|
|
33563
|
-
connectionIds: next
|
|
33564
|
-
});
|
|
33565
|
-
return next;
|
|
33566
|
-
});
|
|
33567
|
-
},
|
|
33568
|
-
async disconnect(id) {
|
|
33569
|
-
return trpcCall(async () => {
|
|
33570
|
-
await deps.trpc.connections.delete.mutate({ id });
|
|
33571
|
-
});
|
|
34095
|
+
const r = t?.withGuide ?? h.withGuide, s = `${`${r ? `${e("gray", $)}
|
|
34096
|
+
` : ""}${M(this.state)} `}${t.message}
|
|
34097
|
+
`, i = t.placeholder ? e("inverse", t.placeholder[0]) + e("dim", t.placeholder.slice(1)) : e(["inverse", "hidden"], "_"), u = this.userInput ? this.userInputWithCursor : i, n = this.value ?? "";
|
|
34098
|
+
switch (this.state) {
|
|
34099
|
+
case "error": {
|
|
34100
|
+
const o = this.error ? ` ${e("yellow", this.error)}` : "", c2 = r ? `${e("yellow", $)} ` : "", a = r ? e("yellow", E2) : "";
|
|
34101
|
+
return `${s.trim()}
|
|
34102
|
+
${c2}${u}
|
|
34103
|
+
${a}${o}
|
|
34104
|
+
`;
|
|
33572
34105
|
}
|
|
33573
|
-
|
|
33574
|
-
}
|
|
33575
|
-
|
|
33576
|
-
// src/modules/connection/domain/config-inputs.ts
|
|
33577
|
-
function configInputsOf(template) {
|
|
33578
|
-
return template.inputs.filter((i) => i.configInput);
|
|
33579
|
-
}
|
|
33580
|
-
function validateConfigInputValue(input, value) {
|
|
33581
|
-
const trimmed = value.trim();
|
|
33582
|
-
if (trimmed === "") return void 0;
|
|
33583
|
-
const label = input.label ?? input.name;
|
|
33584
|
-
if (input.enumValues && !input.enumValues.includes(trimmed)) {
|
|
33585
|
-
const opts = input.enumValues.map((v2) => `\`${v2}\``).join(", ");
|
|
33586
|
-
return `${label}: must be one of ${opts}`;
|
|
33587
|
-
}
|
|
33588
|
-
if (input.pattern && !new RegExp(`^(?:${input.pattern})$`).test(trimmed)) {
|
|
33589
|
-
const expected = input.patternHint ?? `value matching ${input.pattern}`;
|
|
33590
|
-
return `${label}: expected ${expected}`;
|
|
33591
|
-
}
|
|
33592
|
-
return void 0;
|
|
33593
|
-
}
|
|
33594
|
-
function resolveConfigInputFlags(template, rawFlags) {
|
|
33595
|
-
const byName2 = new Map(configInputsOf(template).map((i) => [i.name, i]));
|
|
33596
|
-
const out = {};
|
|
33597
|
-
for (const raw of rawFlags) {
|
|
33598
|
-
const eq = raw.indexOf("=");
|
|
33599
|
-
if (eq < 0) return err2({ kind: "missing-equals", input: raw });
|
|
33600
|
-
const key = raw.slice(0, eq);
|
|
33601
|
-
const value = raw.slice(eq + 1).trim();
|
|
33602
|
-
const input = byName2.get(key);
|
|
33603
|
-
if (!input) {
|
|
33604
|
-
return err2({ kind: "unknown-key", key, validKeys: [...byName2.keys()] });
|
|
34106
|
+
case "submit": {
|
|
34107
|
+
const o = n ? ` ${e("dim", n)}` : "", c2 = r ? e("gray", $) : "";
|
|
34108
|
+
return `${s}${c2}${o}`;
|
|
33605
34109
|
}
|
|
33606
|
-
|
|
33607
|
-
|
|
33608
|
-
|
|
34110
|
+
case "cancel": {
|
|
34111
|
+
const o = n ? ` ${e(["strikethrough", "dim"], n)}` : "", c2 = r ? e("gray", $) : "";
|
|
34112
|
+
return `${s}${c2}${o}${n.trim() ? `
|
|
34113
|
+
${c2}` : ""}`;
|
|
34114
|
+
}
|
|
34115
|
+
default: {
|
|
34116
|
+
const o = r ? `${e("cyan", $)} ` : "", c2 = r ? e("cyan", E2) : "";
|
|
34117
|
+
return `${s}${o}${u}
|
|
34118
|
+
${c2}
|
|
34119
|
+
`;
|
|
33609
34120
|
}
|
|
33610
|
-
const message = validateConfigInputValue(input, value);
|
|
33611
|
-
if (message) return err2({ kind: "invalid-value", key, message });
|
|
33612
|
-
out[key] = value;
|
|
33613
34121
|
}
|
|
33614
|
-
|
|
34122
|
+
} }).prompt();
|
|
34123
|
+
|
|
34124
|
+
// src/modules/shared/prompt-secret.ts
|
|
34125
|
+
function promptSecret(message) {
|
|
34126
|
+
return Ce({
|
|
34127
|
+
message,
|
|
34128
|
+
validate(v2) {
|
|
34129
|
+
if (!v2 || v2.trim() === "") return "Required";
|
|
34130
|
+
return void 0;
|
|
34131
|
+
}
|
|
34132
|
+
});
|
|
33615
34133
|
}
|
|
33616
34134
|
|
|
33617
34135
|
// src/modules/agent/commands/create-interactive.ts
|
|
@@ -33700,8 +34218,8 @@ async function runCreate2(opts, deps) {
|
|
|
33700
34218
|
validate(value) {
|
|
33701
34219
|
const check2 = validateAgentName(value ?? "");
|
|
33702
34220
|
if (check2.ok) return void 0;
|
|
33703
|
-
if (check2.error === "
|
|
33704
|
-
return "name cannot
|
|
34221
|
+
if (check2.error === "id-shape") {
|
|
34222
|
+
return "name cannot have the shape of an agent ID (`agent-` and 16 hex characters)";
|
|
33705
34223
|
}
|
|
33706
34224
|
return "name cannot be empty";
|
|
33707
34225
|
}
|
|
@@ -34146,11 +34664,10 @@ function errorReason2(e2) {
|
|
|
34146
34664
|
}
|
|
34147
34665
|
|
|
34148
34666
|
// src/modules/agent/services/agent-resolver.ts
|
|
34149
|
-
var AGENT_ID_PREFIX = "agent-";
|
|
34150
34667
|
function createAgentResolver(deps) {
|
|
34151
34668
|
return {
|
|
34152
34669
|
async resolve(ref) {
|
|
34153
|
-
if (
|
|
34670
|
+
if (AGENT_ID_RE.test(ref)) {
|
|
34154
34671
|
const got = await deps.agentService.get(ref);
|
|
34155
34672
|
if (!got.ok) return got;
|
|
34156
34673
|
if (got.value === null)
|
|
@@ -34254,7 +34771,7 @@ function buildDeleteCommand(deps) {
|
|
|
34254
34771
|
"emit { deleted, id, name } or { cancelled: true } as JSON"
|
|
34255
34772
|
).addHelpText(
|
|
34256
34773
|
"after",
|
|
34257
|
-
"\nExamples:\n dam agent delete my-agent\n dam agent delete agent-
|
|
34774
|
+
"\nExamples:\n dam agent delete my-agent\n dam agent delete agent-3f9c2b7e41d08a65 --yes\n"
|
|
34258
34775
|
).action(
|
|
34259
34776
|
async (ref, opts) => {
|
|
34260
34777
|
await runDelete(ref, opts, deps);
|
|
@@ -34336,7 +34853,7 @@ function buildGetCommand(deps) {
|
|
|
34336
34853
|
"override the configured server URL for this call"
|
|
34337
34854
|
).option("--json", "emit raw JSON instead of the default vertical layout").addHelpText(
|
|
34338
34855
|
"after",
|
|
34339
|
-
"\nExamples:\n dam agent get my-agent\n dam agent get agent-
|
|
34856
|
+
"\nExamples:\n dam agent get my-agent\n dam agent get agent-3f9c2b7e41d08a65 --json\n"
|
|
34340
34857
|
).action(async (ref, opts) => {
|
|
34341
34858
|
const host = await resolveActiveHost(deps, {
|
|
34342
34859
|
flag: opts.server ? { server: opts.server } : void 0,
|
|
@@ -34449,7 +34966,7 @@ function buildListCommand(deps) {
|
|
|
34449
34966
|
}
|
|
34450
34967
|
if (result.value.length === 0) {
|
|
34451
34968
|
process.stderr.write(
|
|
34452
|
-
"No agents.\nhint: create one with `dam agent create <name> --template <id>`\n"
|
|
34969
|
+
"No agents.\nhint: create one with `dam agent create <name> --template <id> --provider <connection-id>`\n"
|
|
34453
34970
|
);
|
|
34454
34971
|
process.exit(EXIT_SUCCESS);
|
|
34455
34972
|
}
|
|
@@ -35473,126 +35990,7 @@ import {
|
|
|
35473
35990
|
} from "fs/promises";
|
|
35474
35991
|
import { dirname } from "path";
|
|
35475
35992
|
|
|
35476
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
35477
|
-
function getLineColFromPtr(string4, ptr) {
|
|
35478
|
-
let lines = string4.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
35479
|
-
return [lines.length, lines.pop().length + 1];
|
|
35480
|
-
}
|
|
35481
|
-
function makeCodeBlock(string4, line, column) {
|
|
35482
|
-
let lines = string4.split(/\r\n|\n|\r/g);
|
|
35483
|
-
let codeblock = "";
|
|
35484
|
-
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
35485
|
-
for (let i = line - 1; i <= line + 1; i++) {
|
|
35486
|
-
let l = lines[i - 1];
|
|
35487
|
-
if (!l)
|
|
35488
|
-
continue;
|
|
35489
|
-
codeblock += i.toString().padEnd(numberLen, " ");
|
|
35490
|
-
codeblock += ": ";
|
|
35491
|
-
codeblock += l;
|
|
35492
|
-
codeblock += "\n";
|
|
35493
|
-
if (i === line) {
|
|
35494
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
35495
|
-
codeblock += "^\n";
|
|
35496
|
-
}
|
|
35497
|
-
}
|
|
35498
|
-
return codeblock;
|
|
35499
|
-
}
|
|
35500
|
-
var TomlError = class extends Error {
|
|
35501
|
-
line;
|
|
35502
|
-
column;
|
|
35503
|
-
codeblock;
|
|
35504
|
-
constructor(message, options) {
|
|
35505
|
-
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
35506
|
-
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
35507
|
-
super(`Invalid TOML document: ${message}
|
|
35508
|
-
|
|
35509
|
-
${codeblock}`, options);
|
|
35510
|
-
this.line = line;
|
|
35511
|
-
this.column = column;
|
|
35512
|
-
this.codeblock = codeblock;
|
|
35513
|
-
}
|
|
35514
|
-
};
|
|
35515
|
-
|
|
35516
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/util.js
|
|
35517
|
-
function isEscaped(str, ptr) {
|
|
35518
|
-
let i = 0;
|
|
35519
|
-
while (str[ptr - ++i] === "\\")
|
|
35520
|
-
;
|
|
35521
|
-
return --i && i % 2;
|
|
35522
|
-
}
|
|
35523
|
-
function indexOfNewline(str, start = 0, end = str.length) {
|
|
35524
|
-
let idx = str.indexOf("\n", start);
|
|
35525
|
-
if (str[idx - 1] === "\r")
|
|
35526
|
-
idx--;
|
|
35527
|
-
return idx <= end ? idx : -1;
|
|
35528
|
-
}
|
|
35529
|
-
function skipComment(str, ptr) {
|
|
35530
|
-
for (let i = ptr; i < str.length; i++) {
|
|
35531
|
-
let c2 = str[i];
|
|
35532
|
-
if (c2 === "\n")
|
|
35533
|
-
return i;
|
|
35534
|
-
if (c2 === "\r" && str[i + 1] === "\n")
|
|
35535
|
-
return i + 1;
|
|
35536
|
-
if (c2 < " " && c2 !== " " || c2 === "\x7F") {
|
|
35537
|
-
throw new TomlError("control characters are not allowed in comments", {
|
|
35538
|
-
toml: str,
|
|
35539
|
-
ptr
|
|
35540
|
-
});
|
|
35541
|
-
}
|
|
35542
|
-
}
|
|
35543
|
-
return str.length;
|
|
35544
|
-
}
|
|
35545
|
-
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
35546
|
-
let c2;
|
|
35547
|
-
while (1) {
|
|
35548
|
-
while ((c2 = str[ptr]) === " " || c2 === " " || !banNewLines && (c2 === "\n" || c2 === "\r" && str[ptr + 1] === "\n"))
|
|
35549
|
-
ptr++;
|
|
35550
|
-
if (banComments || c2 !== "#")
|
|
35551
|
-
break;
|
|
35552
|
-
ptr = skipComment(str, ptr);
|
|
35553
|
-
}
|
|
35554
|
-
return ptr;
|
|
35555
|
-
}
|
|
35556
|
-
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
35557
|
-
if (!end) {
|
|
35558
|
-
ptr = indexOfNewline(str, ptr);
|
|
35559
|
-
return ptr < 0 ? str.length : ptr;
|
|
35560
|
-
}
|
|
35561
|
-
for (let i = ptr; i < str.length; i++) {
|
|
35562
|
-
let c2 = str[i];
|
|
35563
|
-
if (c2 === "#") {
|
|
35564
|
-
i = indexOfNewline(str, i);
|
|
35565
|
-
} else if (c2 === sep) {
|
|
35566
|
-
return i + 1;
|
|
35567
|
-
} else if (c2 === end || banNewLines && (c2 === "\n" || c2 === "\r" && str[i + 1] === "\n")) {
|
|
35568
|
-
return i;
|
|
35569
|
-
}
|
|
35570
|
-
}
|
|
35571
|
-
throw new TomlError("cannot find end of structure", {
|
|
35572
|
-
toml: str,
|
|
35573
|
-
ptr
|
|
35574
|
-
});
|
|
35575
|
-
}
|
|
35576
|
-
function getStringEnd(str, seek) {
|
|
35577
|
-
let first = str[seek];
|
|
35578
|
-
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
35579
|
-
seek += target.length - 1;
|
|
35580
|
-
do
|
|
35581
|
-
seek = str.indexOf(target, ++seek);
|
|
35582
|
-
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
35583
|
-
if (seek > -1) {
|
|
35584
|
-
seek += target.length;
|
|
35585
|
-
if (target.length > 1) {
|
|
35586
|
-
if (str[seek] === first)
|
|
35587
|
-
seek++;
|
|
35588
|
-
if (str[seek] === first)
|
|
35589
|
-
seek++;
|
|
35590
|
-
}
|
|
35591
|
-
}
|
|
35592
|
-
return seek;
|
|
35593
|
-
}
|
|
35594
|
-
|
|
35595
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/date.js
|
|
35993
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/date.js
|
|
35596
35994
|
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
35597
35995
|
var TomlDate = class _TomlDate extends Date {
|
|
35598
35996
|
#hasDate = false;
|
|
@@ -35684,99 +36082,224 @@ var TomlDate = class _TomlDate extends Date {
|
|
|
35684
36082
|
}
|
|
35685
36083
|
};
|
|
35686
36084
|
|
|
35687
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
36085
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/error.js
|
|
36086
|
+
function getLineColFromPtr(string4, ptr) {
|
|
36087
|
+
let lines = string4.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
36088
|
+
return [lines.length, lines.pop().length + 1];
|
|
36089
|
+
}
|
|
36090
|
+
function makeCodeBlock(string4, line, column) {
|
|
36091
|
+
let lines = string4.split(/\r\n|\n|\r/g);
|
|
36092
|
+
let codeblock = "";
|
|
36093
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
36094
|
+
for (let i = line - 1; i <= line + 1; i++) {
|
|
36095
|
+
let l = lines[i - 1];
|
|
36096
|
+
if (!l)
|
|
36097
|
+
continue;
|
|
36098
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
36099
|
+
codeblock += ": ";
|
|
36100
|
+
codeblock += l;
|
|
36101
|
+
codeblock += "\n";
|
|
36102
|
+
if (i === line) {
|
|
36103
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
36104
|
+
codeblock += "^\n";
|
|
36105
|
+
}
|
|
36106
|
+
}
|
|
36107
|
+
return codeblock;
|
|
36108
|
+
}
|
|
36109
|
+
var TomlError = class extends Error {
|
|
36110
|
+
line;
|
|
36111
|
+
column;
|
|
36112
|
+
codeblock;
|
|
36113
|
+
constructor(message, options) {
|
|
36114
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
36115
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
36116
|
+
super(`Invalid TOML document: ${message}
|
|
36117
|
+
|
|
36118
|
+
${codeblock}`, options);
|
|
36119
|
+
this.line = line;
|
|
36120
|
+
this.column = column;
|
|
36121
|
+
this.codeblock = codeblock;
|
|
36122
|
+
}
|
|
36123
|
+
};
|
|
36124
|
+
|
|
36125
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/util.js
|
|
36126
|
+
function indexOfNewline(str, start = 0) {
|
|
36127
|
+
let idx = str.indexOf("\n", start);
|
|
36128
|
+
if (str.charCodeAt(idx - 1) === 13)
|
|
36129
|
+
idx--;
|
|
36130
|
+
return idx;
|
|
36131
|
+
}
|
|
36132
|
+
function skipComment(ctx) {
|
|
36133
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
36134
|
+
let c2 = ctx.s.charCodeAt(ctx.p);
|
|
36135
|
+
if (c2 === 10)
|
|
36136
|
+
break;
|
|
36137
|
+
if (c2 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
36138
|
+
ctx.p++;
|
|
36139
|
+
break;
|
|
36140
|
+
}
|
|
36141
|
+
if (c2 < 32 && c2 !== 9 || c2 === 127) {
|
|
36142
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
36143
|
+
toml: ctx.s,
|
|
36144
|
+
ptr: ctx.p
|
|
36145
|
+
});
|
|
36146
|
+
}
|
|
36147
|
+
}
|
|
36148
|
+
}
|
|
36149
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
36150
|
+
let c2;
|
|
36151
|
+
while (1) {
|
|
36152
|
+
while ((c2 = ctx.s.charCodeAt(ctx.p)) === 32 || c2 === 9 || !banNewLines && (c2 === 10 || c2 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
36153
|
+
ctx.p++;
|
|
36154
|
+
if (banComments || c2 !== 35)
|
|
36155
|
+
break;
|
|
36156
|
+
skipComment(ctx);
|
|
36157
|
+
}
|
|
36158
|
+
}
|
|
36159
|
+
function skipUntil(ctx, sep, end) {
|
|
36160
|
+
let ptr = ctx.p;
|
|
36161
|
+
if (!end) {
|
|
36162
|
+
ptr = indexOfNewline(ctx.s, ptr);
|
|
36163
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
36164
|
+
return;
|
|
36165
|
+
}
|
|
36166
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
36167
|
+
let c2 = ctx.s.charCodeAt(ctx.p);
|
|
36168
|
+
if (c2 === 35) {
|
|
36169
|
+
skipComment(ctx);
|
|
36170
|
+
} else if (c2 === end || c2 === sep) {
|
|
36171
|
+
return;
|
|
36172
|
+
}
|
|
36173
|
+
}
|
|
36174
|
+
throw new TomlError("cannot find end of structure", {
|
|
36175
|
+
toml: ctx.s,
|
|
36176
|
+
ptr
|
|
36177
|
+
});
|
|
36178
|
+
}
|
|
36179
|
+
|
|
36180
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/primitive.js
|
|
35688
36181
|
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
35689
36182
|
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
35690
36183
|
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
35691
|
-
|
|
35692
|
-
|
|
35693
|
-
|
|
35694
|
-
|
|
35695
|
-
|
|
35696
|
-
|
|
35697
|
-
r: "\r",
|
|
35698
|
-
e: "\x1B",
|
|
35699
|
-
'"': '"',
|
|
35700
|
-
"\\": "\\"
|
|
35701
|
-
};
|
|
35702
|
-
function parseString2(str, ptr = 0, endPtr = str.length) {
|
|
35703
|
-
let isLiteral = str[ptr] === "'";
|
|
35704
|
-
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
36184
|
+
function parseString2(ctx) {
|
|
36185
|
+
let start = ctx.p;
|
|
36186
|
+
let c2 = ctx.s.charCodeAt(ctx.p++);
|
|
36187
|
+
let first = c2;
|
|
36188
|
+
let isLiteral = c2 === 39;
|
|
36189
|
+
let isMultiline = c2 === ctx.s.charCodeAt(ctx.p) && c2 === ctx.s.charCodeAt(ctx.p + 1);
|
|
35705
36190
|
if (isMultiline) {
|
|
35706
|
-
|
|
35707
|
-
|
|
35708
|
-
|
|
35709
|
-
|
|
35710
|
-
|
|
35711
|
-
}
|
|
35712
|
-
let tmp = 0;
|
|
35713
|
-
let isEscape;
|
|
36191
|
+
if ((c2 = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
36192
|
+
ctx.p++;
|
|
36193
|
+
else if (c2 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
36194
|
+
ctx.p += 2;
|
|
36195
|
+
}
|
|
35714
36196
|
let parsed = "";
|
|
35715
|
-
let sliceStart =
|
|
35716
|
-
|
|
35717
|
-
|
|
35718
|
-
|
|
35719
|
-
|
|
35720
|
-
|
|
35721
|
-
|
|
35722
|
-
ptr: ptr - 1
|
|
35723
|
-
});
|
|
35724
|
-
}
|
|
35725
|
-
} else if (c2 < " " && c2 !== " " || c2 === "\x7F") {
|
|
36197
|
+
let sliceStart = ctx.p;
|
|
36198
|
+
let state = 0;
|
|
36199
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
36200
|
+
c2 = ctx.s.charCodeAt(ctx.p);
|
|
36201
|
+
if (isMultiline && (c2 === 10 || c2 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
36202
|
+
state = state && 3;
|
|
36203
|
+
} else if (c2 < 32 && c2 !== 9 || c2 === 127) {
|
|
35726
36204
|
throw new TomlError("control characters are not allowed in strings", {
|
|
35727
|
-
toml:
|
|
35728
|
-
ptr:
|
|
36205
|
+
toml: ctx.s,
|
|
36206
|
+
ptr: ctx.p
|
|
35729
36207
|
});
|
|
35730
|
-
}
|
|
35731
|
-
|
|
35732
|
-
|
|
35733
|
-
|
|
35734
|
-
|
|
35735
|
-
|
|
35736
|
-
|
|
35737
|
-
|
|
35738
|
-
|
|
35739
|
-
|
|
35740
|
-
|
|
35741
|
-
|
|
35742
|
-
|
|
35743
|
-
|
|
35744
|
-
|
|
35745
|
-
|
|
35746
|
-
|
|
35747
|
-
|
|
35748
|
-
|
|
35749
|
-
|
|
35750
|
-
|
|
35751
|
-
|
|
35752
|
-
|
|
35753
|
-
|
|
35754
|
-
|
|
35755
|
-
|
|
35756
|
-
|
|
35757
|
-
|
|
35758
|
-
|
|
35759
|
-
|
|
36208
|
+
} else if ((!state || state === 3) && c2 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
36209
|
+
if (isMultiline) {
|
|
36210
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
36211
|
+
ctx.p++;
|
|
36212
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
36213
|
+
ctx.p++;
|
|
36214
|
+
}
|
|
36215
|
+
if (!state)
|
|
36216
|
+
parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
36217
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
36218
|
+
return parsed;
|
|
36219
|
+
} else if (!state) {
|
|
36220
|
+
if (!isLiteral && c2 === 92) {
|
|
36221
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
36222
|
+
state = 1;
|
|
36223
|
+
}
|
|
36224
|
+
} else if (state === 1) {
|
|
36225
|
+
if (c2 === 120 || c2 === 117 || c2 === 85) {
|
|
36226
|
+
let value = 0;
|
|
36227
|
+
let len = c2 === 120 ? 2 : c2 === 117 ? 4 : 8;
|
|
36228
|
+
for (let j3 = 0; j3 < len; j3++, ctx.p++) {
|
|
36229
|
+
let hex3 = ctx.s.charCodeAt(ctx.p + 1);
|
|
36230
|
+
let digit = (
|
|
36231
|
+
/* 0-9 */
|
|
36232
|
+
hex3 >= 48 && hex3 <= 57 ? hex3 - 48 : (
|
|
36233
|
+
/* A-F */
|
|
36234
|
+
hex3 >= 65 && hex3 <= 70 ? hex3 - 65 + 10 : (
|
|
36235
|
+
/* a-f */
|
|
36236
|
+
hex3 >= 97 && hex3 <= 102 ? hex3 - 97 + 10 : -1
|
|
36237
|
+
)
|
|
36238
|
+
)
|
|
36239
|
+
);
|
|
36240
|
+
if (digit < 0)
|
|
36241
|
+
throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
|
|
36242
|
+
value = value << 4 | digit;
|
|
36243
|
+
}
|
|
36244
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
36245
|
+
throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
|
|
36246
|
+
}
|
|
36247
|
+
parsed += String.fromCodePoint(value);
|
|
36248
|
+
sliceStart = ctx.p + 1;
|
|
36249
|
+
state = 0;
|
|
36250
|
+
} else if (c2 === 32 || c2 === 9) {
|
|
36251
|
+
state = 2;
|
|
35760
36252
|
} else {
|
|
35761
|
-
|
|
35762
|
-
|
|
35763
|
-
|
|
36253
|
+
if (c2 === 98)
|
|
36254
|
+
parsed += "\b";
|
|
36255
|
+
else if (c2 === 116)
|
|
36256
|
+
parsed += " ";
|
|
36257
|
+
else if (c2 === 110)
|
|
36258
|
+
parsed += "\n";
|
|
36259
|
+
else if (c2 === 102)
|
|
36260
|
+
parsed += "\f";
|
|
36261
|
+
else if (c2 === 114)
|
|
36262
|
+
parsed += "\r";
|
|
36263
|
+
else if (c2 === 101)
|
|
36264
|
+
parsed += "\x1B";
|
|
36265
|
+
else if (c2 === 34)
|
|
36266
|
+
parsed += '"';
|
|
36267
|
+
else if (c2 === 92)
|
|
36268
|
+
parsed += "\\";
|
|
36269
|
+
else
|
|
36270
|
+
throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
|
|
36271
|
+
sliceStart = ctx.p + 1;
|
|
36272
|
+
state = 0;
|
|
36273
|
+
}
|
|
36274
|
+
} else if (c2 !== 32 && c2 !== 9) {
|
|
36275
|
+
if (state === 2) {
|
|
36276
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
36277
|
+
toml: ctx.s,
|
|
36278
|
+
ptr: sliceStart
|
|
35764
36279
|
});
|
|
35765
36280
|
}
|
|
35766
|
-
|
|
35767
|
-
|
|
35768
|
-
tmp = ptr - 1;
|
|
35769
|
-
isEscape = true;
|
|
35770
|
-
parsed += str.slice(sliceStart, tmp);
|
|
36281
|
+
state = !isLiteral && c2 === 92 ? 1 : 0;
|
|
36282
|
+
sliceStart = ctx.p;
|
|
35771
36283
|
}
|
|
35772
36284
|
}
|
|
35773
|
-
|
|
36285
|
+
throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
|
|
35774
36286
|
}
|
|
35775
|
-
function
|
|
35776
|
-
|
|
35777
|
-
|
|
35778
|
-
if (
|
|
35779
|
-
|
|
36287
|
+
function sliceAndTrimEndOf(ctx, start, end) {
|
|
36288
|
+
let value = ctx.s.slice(start, end);
|
|
36289
|
+
let commentIdx = value.indexOf("#");
|
|
36290
|
+
if (commentIdx > 0) {
|
|
36291
|
+
skipComment({ s: value, p: commentIdx, d: 0 });
|
|
36292
|
+
value = value.slice(0, commentIdx);
|
|
36293
|
+
}
|
|
36294
|
+
return value.trimEnd();
|
|
36295
|
+
}
|
|
36296
|
+
function parseValue(ctx, integersAsBigInt, end) {
|
|
36297
|
+
let ptr = ctx.p;
|
|
36298
|
+
let err3 = { toml: ctx.s, ptr };
|
|
36299
|
+
skipUntil(ctx, 44, end);
|
|
36300
|
+
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
36301
|
+
if (!value)
|
|
36302
|
+
throw new TomlError("incomplete declaration: value expected", err3);
|
|
35780
36303
|
if (value === "-inf")
|
|
35781
36304
|
return -Infinity;
|
|
35782
36305
|
if (value === "inf" || value === "+inf")
|
|
@@ -35788,257 +36311,204 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
|
35788
36311
|
let isInt = INT_REGEX.test(value);
|
|
35789
36312
|
if (isInt || FLOAT_REGEX.test(value)) {
|
|
35790
36313
|
if (LEADING_ZERO.test(value)) {
|
|
35791
|
-
throw new TomlError("leading zeroes are not allowed",
|
|
35792
|
-
toml,
|
|
35793
|
-
ptr
|
|
35794
|
-
});
|
|
36314
|
+
throw new TomlError("leading zeroes are not allowed", err3);
|
|
35795
36315
|
}
|
|
35796
36316
|
value = value.replace(/_/g, "");
|
|
35797
36317
|
let numeric = +value;
|
|
35798
36318
|
if (isNaN(numeric)) {
|
|
35799
|
-
throw new TomlError("invalid number",
|
|
35800
|
-
toml,
|
|
35801
|
-
ptr
|
|
35802
|
-
});
|
|
36319
|
+
throw new TomlError("invalid number", err3);
|
|
35803
36320
|
}
|
|
35804
36321
|
if (isInt) {
|
|
35805
36322
|
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
35806
|
-
throw new TomlError("integer value cannot be represented losslessly",
|
|
35807
|
-
toml,
|
|
35808
|
-
ptr
|
|
35809
|
-
});
|
|
36323
|
+
throw new TomlError("integer value cannot be represented losslessly", err3);
|
|
35810
36324
|
}
|
|
35811
36325
|
if (isInt || integersAsBigInt === true)
|
|
35812
|
-
numeric = BigInt(value);
|
|
35813
|
-
}
|
|
35814
|
-
return numeric;
|
|
35815
|
-
}
|
|
35816
|
-
const date5 = new TomlDate(value);
|
|
35817
|
-
if (!date5.isValid()) {
|
|
35818
|
-
throw new TomlError("invalid value", {
|
|
35819
|
-
toml,
|
|
35820
|
-
ptr
|
|
35821
|
-
});
|
|
35822
|
-
}
|
|
35823
|
-
return date5;
|
|
35824
|
-
}
|
|
35825
|
-
|
|
35826
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/extract.js
|
|
35827
|
-
function sliceAndTrimEndOf(str, startPtr, endPtr) {
|
|
35828
|
-
let value = str.slice(startPtr, endPtr);
|
|
35829
|
-
let commentIdx = value.indexOf("#");
|
|
35830
|
-
if (commentIdx > -1) {
|
|
35831
|
-
skipComment(str, commentIdx);
|
|
35832
|
-
value = value.slice(0, commentIdx);
|
|
35833
|
-
}
|
|
35834
|
-
return [value.trimEnd(), commentIdx];
|
|
35835
|
-
}
|
|
35836
|
-
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
35837
|
-
if (depth === 0) {
|
|
35838
|
-
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
35839
|
-
toml: str,
|
|
35840
|
-
ptr
|
|
35841
|
-
});
|
|
35842
|
-
}
|
|
35843
|
-
let c2 = str[ptr];
|
|
35844
|
-
if (c2 === "[" || c2 === "{") {
|
|
35845
|
-
let [value, endPtr2] = c2 === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
|
|
35846
|
-
if (end) {
|
|
35847
|
-
endPtr2 = skipVoid(str, endPtr2);
|
|
35848
|
-
if (str[endPtr2] === ",")
|
|
35849
|
-
endPtr2++;
|
|
35850
|
-
else if (str[endPtr2] !== end) {
|
|
35851
|
-
throw new TomlError("expected comma or end of structure", {
|
|
35852
|
-
toml: str,
|
|
35853
|
-
ptr: endPtr2
|
|
35854
|
-
});
|
|
35855
|
-
}
|
|
36326
|
+
numeric = BigInt(value);
|
|
35856
36327
|
}
|
|
35857
|
-
return
|
|
36328
|
+
return numeric;
|
|
35858
36329
|
}
|
|
35859
|
-
|
|
35860
|
-
if (
|
|
35861
|
-
|
|
35862
|
-
|
|
35863
|
-
|
|
35864
|
-
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
|
|
35868
|
-
|
|
35869
|
-
|
|
35870
|
-
|
|
35871
|
-
|
|
36330
|
+
const date5 = new TomlDate(value);
|
|
36331
|
+
if (!date5.isValid())
|
|
36332
|
+
throw new TomlError("invalid value", err3);
|
|
36333
|
+
return date5;
|
|
36334
|
+
}
|
|
36335
|
+
|
|
36336
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/extract.js
|
|
36337
|
+
function extractValue(ctx, end, integersAsBigInt) {
|
|
36338
|
+
let ptr = ctx.p;
|
|
36339
|
+
let c2 = ctx.s.charCodeAt(ptr);
|
|
36340
|
+
if (c2 === 91 || c2 === 123) {
|
|
36341
|
+
if (!ctx.d--) {
|
|
36342
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
36343
|
+
toml: ctx.s,
|
|
36344
|
+
ptr
|
|
36345
|
+
});
|
|
35872
36346
|
}
|
|
35873
|
-
|
|
36347
|
+
let value = c2 === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
36348
|
+
ctx.d++;
|
|
36349
|
+
return value;
|
|
35874
36350
|
}
|
|
35875
|
-
|
|
35876
|
-
|
|
35877
|
-
|
|
35878
|
-
|
|
35879
|
-
|
|
35880
|
-
ptr
|
|
35881
|
-
|
|
36351
|
+
if (c2 === 34 || c2 === 39) {
|
|
36352
|
+
return parseString2(ctx);
|
|
36353
|
+
}
|
|
36354
|
+
if (c2 === 116) {
|
|
36355
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
36356
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
36357
|
+
ctx.p++;
|
|
36358
|
+
return true;
|
|
35882
36359
|
}
|
|
35883
|
-
if (
|
|
35884
|
-
|
|
35885
|
-
|
|
36360
|
+
if (c2 === 102) {
|
|
36361
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
36362
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
36363
|
+
ctx.p++;
|
|
36364
|
+
return false;
|
|
35886
36365
|
}
|
|
35887
|
-
return
|
|
35888
|
-
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
35889
|
-
endPtr
|
|
35890
|
-
];
|
|
36366
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
35891
36367
|
}
|
|
35892
36368
|
|
|
35893
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
36369
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/struct.js
|
|
35894
36370
|
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
35895
|
-
function parseKey(
|
|
35896
|
-
let
|
|
36371
|
+
function parseKey(ctx, end = "=") {
|
|
36372
|
+
let start = ctx.p;
|
|
36373
|
+
let dot = start - 1;
|
|
35897
36374
|
let parsed = [];
|
|
35898
|
-
let endPtr =
|
|
36375
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
35899
36376
|
if (endPtr < 0) {
|
|
35900
36377
|
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
35901
|
-
toml:
|
|
35902
|
-
ptr
|
|
36378
|
+
toml: ctx.s,
|
|
36379
|
+
ptr: start
|
|
35903
36380
|
});
|
|
35904
36381
|
}
|
|
35905
36382
|
do {
|
|
35906
|
-
let c2 =
|
|
35907
|
-
if (c2 !==
|
|
35908
|
-
if (c2 ===
|
|
35909
|
-
if (c2 ===
|
|
36383
|
+
let c2 = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
36384
|
+
if (c2 !== 32 && c2 !== 9) {
|
|
36385
|
+
if (c2 === 34 || c2 === 39) {
|
|
36386
|
+
if (c2 === ctx.s.charCodeAt(ctx.p + 1) && c2 === ctx.s.charCodeAt(ctx.p + 2)) {
|
|
35910
36387
|
throw new TomlError("multiline strings are not allowed in keys", {
|
|
35911
|
-
toml:
|
|
35912
|
-
ptr
|
|
36388
|
+
toml: ctx.s,
|
|
36389
|
+
ptr: ctx.p
|
|
35913
36390
|
});
|
|
35914
36391
|
}
|
|
35915
|
-
let
|
|
35916
|
-
|
|
35917
|
-
|
|
35918
|
-
toml: str,
|
|
35919
|
-
ptr
|
|
35920
|
-
});
|
|
35921
|
-
}
|
|
35922
|
-
dot = str.indexOf(".", eos);
|
|
35923
|
-
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
36392
|
+
let part = parseString2(ctx);
|
|
36393
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
36394
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
35924
36395
|
let newLine = indexOfNewline(strEnd);
|
|
35925
36396
|
if (newLine > -1) {
|
|
35926
36397
|
throw new TomlError("newlines are not allowed in keys", {
|
|
35927
|
-
toml:
|
|
35928
|
-
ptr:
|
|
36398
|
+
toml: ctx.s,
|
|
36399
|
+
ptr: newLine
|
|
35929
36400
|
});
|
|
35930
36401
|
}
|
|
35931
36402
|
if (strEnd.trimStart()) {
|
|
35932
36403
|
throw new TomlError("found extra tokens after the string part", {
|
|
35933
|
-
toml:
|
|
35934
|
-
ptr:
|
|
36404
|
+
toml: ctx.s,
|
|
36405
|
+
ptr: ctx.p
|
|
35935
36406
|
});
|
|
35936
36407
|
}
|
|
35937
|
-
if (endPtr <
|
|
35938
|
-
endPtr =
|
|
36408
|
+
if (endPtr < ctx.p) {
|
|
36409
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
35939
36410
|
if (endPtr < 0) {
|
|
35940
36411
|
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
35941
|
-
toml:
|
|
35942
|
-
ptr
|
|
36412
|
+
toml: ctx.s,
|
|
36413
|
+
ptr: start
|
|
35943
36414
|
});
|
|
35944
36415
|
}
|
|
35945
36416
|
}
|
|
35946
|
-
parsed.push(
|
|
36417
|
+
parsed.push(part);
|
|
35947
36418
|
} else {
|
|
35948
|
-
dot =
|
|
35949
|
-
let part =
|
|
36419
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
36420
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
35950
36421
|
if (!KEY_PART_RE.test(part)) {
|
|
35951
36422
|
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
35952
|
-
toml:
|
|
35953
|
-
ptr
|
|
36423
|
+
toml: ctx.s,
|
|
36424
|
+
ptr: ctx.p
|
|
35954
36425
|
});
|
|
35955
36426
|
}
|
|
35956
36427
|
parsed.push(part.trimEnd());
|
|
35957
36428
|
}
|
|
35958
36429
|
}
|
|
35959
36430
|
} while (dot + 1 && dot < endPtr);
|
|
35960
|
-
|
|
36431
|
+
ctx.p = endPtr + 1;
|
|
36432
|
+
skipVoid(ctx, true, true);
|
|
36433
|
+
return parsed;
|
|
35961
36434
|
}
|
|
35962
|
-
function parseInlineTable(
|
|
36435
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
35963
36436
|
let res = {};
|
|
35964
36437
|
let seen = /* @__PURE__ */ new Set();
|
|
35965
36438
|
let c2;
|
|
35966
|
-
|
|
35967
|
-
while (
|
|
35968
|
-
|
|
35969
|
-
|
|
35970
|
-
|
|
35971
|
-
|
|
35972
|
-
|
|
35973
|
-
|
|
35974
|
-
|
|
35975
|
-
|
|
35976
|
-
|
|
35977
|
-
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
35981
|
-
|
|
35982
|
-
|
|
35983
|
-
k2 = key[i];
|
|
35984
|
-
if ((hasOwn = Object.hasOwn(t, k2)) && (typeof t[k2] !== "object" || seen.has(t[k2]))) {
|
|
35985
|
-
throw new TomlError("trying to redefine an already defined value", {
|
|
35986
|
-
toml: str,
|
|
35987
|
-
ptr
|
|
35988
|
-
});
|
|
35989
|
-
}
|
|
35990
|
-
if (!hasOwn && k2 === "__proto__") {
|
|
35991
|
-
Object.defineProperty(t, k2, { enumerable: true, configurable: true, writable: true });
|
|
35992
|
-
}
|
|
35993
|
-
}
|
|
35994
|
-
if (hasOwn) {
|
|
36439
|
+
ctx.p++;
|
|
36440
|
+
while (ctx.p < ctx.s.length) {
|
|
36441
|
+
skipVoid(ctx);
|
|
36442
|
+
if ((c2 = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
36443
|
+
ctx.p++;
|
|
36444
|
+
return res;
|
|
36445
|
+
}
|
|
36446
|
+
let k2;
|
|
36447
|
+
let t = res;
|
|
36448
|
+
let hasOwn = false;
|
|
36449
|
+
let p2 = ctx.p;
|
|
36450
|
+
let key = parseKey(ctx);
|
|
36451
|
+
for (let i = 0; i < key.length; i++) {
|
|
36452
|
+
if (i)
|
|
36453
|
+
t = hasOwn ? t[k2] : t[k2] = {};
|
|
36454
|
+
k2 = key[i];
|
|
36455
|
+
if ((hasOwn = Object.hasOwn(t, k2)) && (typeof t[k2] !== "object" || seen.has(t[k2]))) {
|
|
35995
36456
|
throw new TomlError("trying to redefine an already defined value", {
|
|
35996
|
-
toml:
|
|
35997
|
-
ptr
|
|
36457
|
+
toml: ctx.s,
|
|
36458
|
+
ptr: p2
|
|
35998
36459
|
});
|
|
35999
36460
|
}
|
|
36000
|
-
|
|
36001
|
-
|
|
36002
|
-
|
|
36003
|
-
|
|
36461
|
+
if (!hasOwn && k2 === "__proto__") {
|
|
36462
|
+
Object.defineProperty(t, k2, { enumerable: true, configurable: true, writable: true });
|
|
36463
|
+
}
|
|
36464
|
+
}
|
|
36465
|
+
if (hasOwn) {
|
|
36466
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
36467
|
+
toml: ctx.s,
|
|
36468
|
+
ptr: ctx.p
|
|
36469
|
+
});
|
|
36470
|
+
}
|
|
36471
|
+
let value = extractValue(ctx, 125, integersAsBigInt);
|
|
36472
|
+
seen.add(t[k2] = value);
|
|
36473
|
+
skipVoid(ctx);
|
|
36474
|
+
if ((c2 = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
36475
|
+
return res;
|
|
36476
|
+
}
|
|
36477
|
+
if (c2 !== 44) {
|
|
36478
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
36004
36479
|
}
|
|
36005
36480
|
}
|
|
36006
|
-
|
|
36007
|
-
|
|
36008
|
-
|
|
36009
|
-
|
|
36010
|
-
});
|
|
36011
|
-
}
|
|
36012
|
-
return [res, ptr];
|
|
36481
|
+
throw new TomlError("unfinished table encountered", {
|
|
36482
|
+
toml: ctx.s,
|
|
36483
|
+
ptr: ctx.p
|
|
36484
|
+
});
|
|
36013
36485
|
}
|
|
36014
|
-
function parseArray(
|
|
36486
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
36015
36487
|
let res = [];
|
|
36016
36488
|
let c2;
|
|
36017
|
-
|
|
36018
|
-
while (
|
|
36019
|
-
|
|
36020
|
-
|
|
36021
|
-
|
|
36022
|
-
|
|
36023
|
-
|
|
36024
|
-
|
|
36025
|
-
|
|
36026
|
-
|
|
36027
|
-
|
|
36028
|
-
|
|
36029
|
-
|
|
36030
|
-
|
|
36031
|
-
|
|
36032
|
-
if (!c2) {
|
|
36033
|
-
throw new TomlError("unfinished array encountered", {
|
|
36034
|
-
toml: str,
|
|
36035
|
-
ptr
|
|
36036
|
-
});
|
|
36489
|
+
ctx.p++;
|
|
36490
|
+
while (ctx.p < ctx.s.length) {
|
|
36491
|
+
skipVoid(ctx);
|
|
36492
|
+
if ((c2 = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
36493
|
+
ctx.p++;
|
|
36494
|
+
return res;
|
|
36495
|
+
}
|
|
36496
|
+
res.push(extractValue(ctx, 93, integersAsBigInt));
|
|
36497
|
+
skipVoid(ctx);
|
|
36498
|
+
if ((c2 = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
36499
|
+
return res;
|
|
36500
|
+
}
|
|
36501
|
+
if (c2 !== 44) {
|
|
36502
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
36503
|
+
}
|
|
36037
36504
|
}
|
|
36038
|
-
|
|
36505
|
+
throw new TomlError("unfinished array encountered", {
|
|
36506
|
+
toml: ctx.s,
|
|
36507
|
+
ptr: ctx.p
|
|
36508
|
+
});
|
|
36039
36509
|
}
|
|
36040
36510
|
|
|
36041
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
36511
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/parse.js
|
|
36042
36512
|
function peekTable(key, table, meta3, type) {
|
|
36043
36513
|
let t = table;
|
|
36044
36514
|
let m = meta3;
|
|
@@ -36099,25 +36569,29 @@ function peekTable(key, table, meta3, type) {
|
|
|
36099
36569
|
return [k2, t, state.c];
|
|
36100
36570
|
}
|
|
36101
36571
|
function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
36572
|
+
let ctx = { s: toml, p: 0, d: maxDepth };
|
|
36102
36573
|
let res = {};
|
|
36103
36574
|
let meta3 = {};
|
|
36575
|
+
let tmp;
|
|
36104
36576
|
let tbl = res;
|
|
36105
36577
|
let m = meta3;
|
|
36106
|
-
|
|
36107
|
-
|
|
36108
|
-
|
|
36109
|
-
let
|
|
36578
|
+
skipVoid(ctx);
|
|
36579
|
+
while (ctx.p < toml.length) {
|
|
36580
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
36581
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
36582
|
+
tmp = ctx.p += +isTableArray;
|
|
36583
|
+
let k2 = parseKey(ctx, "]");
|
|
36110
36584
|
if (isTableArray) {
|
|
36111
|
-
if (toml
|
|
36585
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) {
|
|
36112
36586
|
throw new TomlError("expected end of table declaration", {
|
|
36113
36587
|
toml,
|
|
36114
|
-
ptr:
|
|
36588
|
+
ptr: ctx.p - 1
|
|
36115
36589
|
});
|
|
36116
36590
|
}
|
|
36117
|
-
|
|
36591
|
+
ctx.p++;
|
|
36118
36592
|
}
|
|
36119
36593
|
let p2 = peekTable(
|
|
36120
|
-
k2
|
|
36594
|
+
k2,
|
|
36121
36595
|
res,
|
|
36122
36596
|
meta3,
|
|
36123
36597
|
isTableArray ? 2 : 1
|
|
@@ -36126,16 +36600,16 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
36126
36600
|
if (!p2) {
|
|
36127
36601
|
throw new TomlError("trying to redefine an already defined table or value", {
|
|
36128
36602
|
toml,
|
|
36129
|
-
ptr
|
|
36603
|
+
ptr: tmp
|
|
36130
36604
|
});
|
|
36131
36605
|
}
|
|
36132
36606
|
m = p2[2];
|
|
36133
36607
|
tbl = p2[1];
|
|
36134
|
-
ptr = k2[1];
|
|
36135
36608
|
} else {
|
|
36136
|
-
|
|
36609
|
+
tmp = ctx.p;
|
|
36610
|
+
let k2 = parseKey(ctx);
|
|
36137
36611
|
let p2 = peekTable(
|
|
36138
|
-
k2
|
|
36612
|
+
k2,
|
|
36139
36613
|
tbl,
|
|
36140
36614
|
m,
|
|
36141
36615
|
0
|
|
@@ -36144,34 +36618,36 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
36144
36618
|
if (!p2) {
|
|
36145
36619
|
throw new TomlError("trying to redefine an already defined table or value", {
|
|
36146
36620
|
toml,
|
|
36147
|
-
ptr
|
|
36621
|
+
ptr: tmp
|
|
36148
36622
|
});
|
|
36149
36623
|
}
|
|
36150
|
-
|
|
36151
|
-
p2[1][p2[0]] = v2[0];
|
|
36152
|
-
ptr = v2[1];
|
|
36624
|
+
p2[1][p2[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
36153
36625
|
}
|
|
36154
|
-
|
|
36155
|
-
if (toml
|
|
36626
|
+
skipVoid(ctx, true);
|
|
36627
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
36156
36628
|
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
36157
36629
|
toml,
|
|
36158
|
-
ptr
|
|
36630
|
+
ptr: ctx.p
|
|
36159
36631
|
});
|
|
36160
36632
|
}
|
|
36161
|
-
|
|
36633
|
+
skipVoid(ctx);
|
|
36162
36634
|
}
|
|
36163
36635
|
return res;
|
|
36164
36636
|
}
|
|
36165
36637
|
|
|
36166
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
36638
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/stringify.js
|
|
36167
36639
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
36168
36640
|
function extendedTypeOf(obj) {
|
|
36169
36641
|
let type = typeof obj;
|
|
36170
36642
|
if (type === "object") {
|
|
36171
36643
|
if (Array.isArray(obj))
|
|
36172
36644
|
return "array";
|
|
36173
|
-
if (obj instanceof Date)
|
|
36645
|
+
if (typeof obj?.getUTCDate === "function" && obj instanceof Date)
|
|
36174
36646
|
return "date";
|
|
36647
|
+
if (globalThis.Temporal && // check for the 'since' property as an early bailout that avoids running all 5 instanceof checks
|
|
36648
|
+
typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) {
|
|
36649
|
+
return "temporal";
|
|
36650
|
+
}
|
|
36175
36651
|
}
|
|
36176
36652
|
return type;
|
|
36177
36653
|
}
|
|
@@ -36185,38 +36661,42 @@ function isArrayOfTables(obj) {
|
|
|
36185
36661
|
function formatString(s) {
|
|
36186
36662
|
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
36187
36663
|
}
|
|
36664
|
+
function stringifyTemporal(temporal) {
|
|
36665
|
+
return temporal.toString({
|
|
36666
|
+
calendarName: "never",
|
|
36667
|
+
timeZoneName: "never"
|
|
36668
|
+
});
|
|
36669
|
+
}
|
|
36188
36670
|
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
36189
36671
|
if (depth === 0) {
|
|
36190
36672
|
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
36191
36673
|
}
|
|
36192
|
-
|
|
36193
|
-
|
|
36194
|
-
|
|
36195
|
-
|
|
36196
|
-
|
|
36197
|
-
|
|
36198
|
-
|
|
36199
|
-
|
|
36200
|
-
|
|
36201
|
-
|
|
36202
|
-
|
|
36203
|
-
|
|
36204
|
-
|
|
36205
|
-
|
|
36206
|
-
|
|
36207
|
-
|
|
36208
|
-
|
|
36209
|
-
|
|
36210
|
-
|
|
36211
|
-
|
|
36212
|
-
|
|
36213
|
-
|
|
36214
|
-
|
|
36215
|
-
|
|
36216
|
-
|
|
36217
|
-
|
|
36218
|
-
if (type === "array") {
|
|
36219
|
-
return stringifyArray(val, depth, numberAsFloat);
|
|
36674
|
+
switch (type) {
|
|
36675
|
+
// @ts-expect-error -- intentional fallthrough case
|
|
36676
|
+
case "number":
|
|
36677
|
+
if (isNaN(val))
|
|
36678
|
+
return "nan";
|
|
36679
|
+
if (val === Infinity)
|
|
36680
|
+
return "inf";
|
|
36681
|
+
if (val === -Infinity)
|
|
36682
|
+
return "-inf";
|
|
36683
|
+
if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
|
|
36684
|
+
return val.toFixed(1);
|
|
36685
|
+
case "bigint":
|
|
36686
|
+
case "boolean":
|
|
36687
|
+
return val.toString();
|
|
36688
|
+
case "string":
|
|
36689
|
+
return formatString(val);
|
|
36690
|
+
case "date":
|
|
36691
|
+
if (isNaN(val.getTime()))
|
|
36692
|
+
throw new TypeError("cannot serialize invalid date");
|
|
36693
|
+
return val.toISOString();
|
|
36694
|
+
case "object":
|
|
36695
|
+
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
36696
|
+
case "array":
|
|
36697
|
+
return stringifyArray(val, depth, numberAsFloat);
|
|
36698
|
+
case "temporal":
|
|
36699
|
+
return stringifyTemporal(val);
|
|
36220
36700
|
}
|
|
36221
36701
|
}
|
|
36222
36702
|
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
@@ -40414,6 +40894,13 @@ function createRunService(deps) {
|
|
|
40414
40894
|
const parsed = platformRunResultResponseSchema.safeParse(res.result);
|
|
40415
40895
|
return parsed.success ? parsed.data : null;
|
|
40416
40896
|
}
|
|
40897
|
+
function interruptedRun(sessionId) {
|
|
40898
|
+
return err2({
|
|
40899
|
+
kind: "run-failed",
|
|
40900
|
+
reason: "the run was interrupted and will not finish \u2014 the agent went down mid-run; run it again",
|
|
40901
|
+
sessionId
|
|
40902
|
+
});
|
|
40903
|
+
}
|
|
40417
40904
|
async function reconnectAndFinish(opts) {
|
|
40418
40905
|
const { ctx, sessionId, promptId, deadlineAt } = opts;
|
|
40419
40906
|
let backoffStep = 0;
|
|
@@ -40451,6 +40938,8 @@ function createRunService(deps) {
|
|
|
40451
40938
|
const record2 = await fetchRunResult(conn, sessionId);
|
|
40452
40939
|
if (record2?.status === "done" && matchesPrompt(record2.result, promptId))
|
|
40453
40940
|
return finish(record2.result);
|
|
40941
|
+
if (record2?.status === "interrupted")
|
|
40942
|
+
return interruptedRun(sessionId);
|
|
40454
40943
|
const event2 = await waiter.next(deadlineAt, conn.closed);
|
|
40455
40944
|
if (event2 === "timed-out")
|
|
40456
40945
|
return ok2({ kind: "timed-out", sessionId });
|
|
@@ -40641,6 +41130,7 @@ function createRunService(deps) {
|
|
|
40641
41130
|
});
|
|
40642
41131
|
if (record2.status === "done")
|
|
40643
41132
|
return ok2({ kind: "done", result: record2.result });
|
|
41133
|
+
if (record2.status === "interrupted") return interruptedRun(sessionId);
|
|
40644
41134
|
if (record2.status === "none" && !input.wait)
|
|
40645
41135
|
return ok2({ kind: "none", sessionId });
|
|
40646
41136
|
if (!input.wait) return ok2({ kind: "pending", sessionId });
|
|
@@ -41485,7 +41975,7 @@ function createProcessEnvReader() {
|
|
|
41485
41975
|
|
|
41486
41976
|
// src/modules/cli/infrastructure/package-version.ts
|
|
41487
41977
|
function readPackageVersion() {
|
|
41488
|
-
return true ? "0.2.
|
|
41978
|
+
return true ? "0.2.18-rc2" : DEV_VERSION;
|
|
41489
41979
|
}
|
|
41490
41980
|
|
|
41491
41981
|
// src/modules/cli/infrastructure/version-probe.ts
|
|
@@ -42207,15 +42697,6 @@ function formatPresetNote(inputs) {
|
|
|
42207
42697
|
`;
|
|
42208
42698
|
}
|
|
42209
42699
|
|
|
42210
|
-
// src/modules/connection/domain/connection-ref.ts
|
|
42211
|
-
var CONNECTION_ID_PREFIX = "conn-";
|
|
42212
|
-
function resolveConnectionRef(connections, ref) {
|
|
42213
|
-
if (ref.startsWith(CONNECTION_ID_PREFIX)) {
|
|
42214
|
-
return connections.find((c2) => c2.id === ref) ?? null;
|
|
42215
|
-
}
|
|
42216
|
-
return connections.find((c2) => c2.name === ref) ?? null;
|
|
42217
|
-
}
|
|
42218
|
-
|
|
42219
42700
|
// src/modules/connection/commands/disconnect.ts
|
|
42220
42701
|
function buildDisconnectCommand(deps) {
|
|
42221
42702
|
return new Command("disconnect").description("Remove a team connection (deletes the stored credential)").argument(
|
|
@@ -43077,7 +43558,7 @@ function buildListCommand5(deps) {
|
|
|
43077
43558
|
"override the configured server URL for this call"
|
|
43078
43559
|
).option("--json", "emit raw JSON instead of the default table").addHelpText(
|
|
43079
43560
|
"after",
|
|
43080
|
-
"\nExamples:\n dam network list my-agent\n dam network list agent-
|
|
43561
|
+
"\nExamples:\n dam network list my-agent\n dam network list agent-3f9c2b7e41d08a65 --json\n"
|
|
43081
43562
|
).action(async (ref, opts) => {
|
|
43082
43563
|
const host = await resolveActiveHost(deps, {
|
|
43083
43564
|
flag: opts.server ? { server: opts.server } : void 0,
|
|
@@ -43593,13 +44074,40 @@ function printTrpcReadError(e2, path2, host) {
|
|
|
43593
44074
|
}
|
|
43594
44075
|
|
|
43595
44076
|
// src/modules/file/commands/list.ts
|
|
44077
|
+
var entrySuffix = { file: "", dir: "/" };
|
|
44078
|
+
var MAX_DIRECTORY_BATCH_SIZE = 500;
|
|
44079
|
+
var MAX_ENCODED_DIRECTORY_INPUT_LENGTH = 7e3;
|
|
44080
|
+
var DirectoryPathTooLongError = class extends Error {
|
|
44081
|
+
};
|
|
44082
|
+
function* directoryBatches(frontier) {
|
|
44083
|
+
let paths = [];
|
|
44084
|
+
const emptyInputLength = encodeURIComponent(
|
|
44085
|
+
JSON.stringify({ 0: { paths: [] } })
|
|
44086
|
+
).length;
|
|
44087
|
+
let encodedInputLength = emptyInputLength;
|
|
44088
|
+
for (const path2 of frontier) {
|
|
44089
|
+
const pathLength = encodeURIComponent(JSON.stringify(path2)).length;
|
|
44090
|
+
if (emptyInputLength + pathLength > MAX_ENCODED_DIRECTORY_INPUT_LENGTH) {
|
|
44091
|
+
throw new DirectoryPathTooLongError(
|
|
44092
|
+
`cannot list \`${path2}\`: directory path exceeds the request URL size limit`
|
|
44093
|
+
);
|
|
44094
|
+
}
|
|
44095
|
+
const separatorLength = paths.length > 0 ? 3 : 0;
|
|
44096
|
+
if (paths.length > 0 && (paths.length === MAX_DIRECTORY_BATCH_SIZE || encodedInputLength + separatorLength + pathLength > MAX_ENCODED_DIRECTORY_INPUT_LENGTH)) {
|
|
44097
|
+
yield paths;
|
|
44098
|
+
paths = [];
|
|
44099
|
+
encodedInputLength = emptyInputLength;
|
|
44100
|
+
}
|
|
44101
|
+
encodedInputLength += (paths.length > 0 ? 3 : 0) + pathLength;
|
|
44102
|
+
paths.push(path2);
|
|
44103
|
+
}
|
|
44104
|
+
if (paths.length > 0) yield paths;
|
|
44105
|
+
}
|
|
43596
44106
|
function buildFileListCommand(deps) {
|
|
43597
|
-
return new Command("list").description(
|
|
43598
|
-
"List immediate children of a directory in an Agent's workspace"
|
|
43599
|
-
).argument("<ref>", "Agent Ref \u2014 name or 'agent-\u2026' ID").argument(
|
|
44107
|
+
return new Command("list").description("List a directory in an Agent's workspace").argument("<ref>", "Agent Ref \u2014 name or 'agent-\u2026' ID").argument(
|
|
43600
44108
|
"[remote-path]",
|
|
43601
44109
|
"directory to list (workspace-relative; defaults to root)"
|
|
43602
|
-
).option("--server <url>", "override the configured server URL").option("--
|
|
44110
|
+
).option("--server <url>", "override the configured server URL").option("-R, --recursive", "list all nested files and directories").option("--json", "emit entries as JSON").action(
|
|
43603
44111
|
async (ref, remotePath, opts) => {
|
|
43604
44112
|
const flag = opts.server ? { server: opts.server } : void 0;
|
|
43605
44113
|
const host = await resolveActiveHost(deps, {
|
|
@@ -43623,30 +44131,46 @@ function buildFileListCommand(deps) {
|
|
|
43623
44131
|
tokenProvider: deps.tokenProvider
|
|
43624
44132
|
});
|
|
43625
44133
|
const dir = (remotePath ?? "").replace(/\/+$/, "");
|
|
43626
|
-
|
|
44134
|
+
const entries = [];
|
|
43627
44135
|
try {
|
|
43628
|
-
|
|
43629
|
-
|
|
43630
|
-
|
|
43631
|
-
|
|
43632
|
-
|
|
43633
|
-
|
|
43634
|
-
|
|
43635
|
-
|
|
44136
|
+
let frontier = [dir];
|
|
44137
|
+
while (frontier.length > 0) {
|
|
44138
|
+
const nextFrontier = [];
|
|
44139
|
+
for (const paths of directoryBatches(frontier)) {
|
|
44140
|
+
const { results } = await trpc.files.listDirs.query({ paths });
|
|
44141
|
+
for (const [index, current] of paths.entries()) {
|
|
44142
|
+
const res = results[index];
|
|
44143
|
+
if (!res || !res.ok) {
|
|
44144
|
+
const reason = res?.error ?? "not-found";
|
|
44145
|
+
process.stderr.write(
|
|
44146
|
+
`error: cannot list \`${current || "/"}\`: ${reason}
|
|
43636
44147
|
`
|
|
43637
|
-
|
|
43638
|
-
|
|
44148
|
+
);
|
|
44149
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
44150
|
+
}
|
|
44151
|
+
for (const entry of res.entries) {
|
|
44152
|
+
const path2 = current ? `${current}/${entry.name}` : entry.name;
|
|
44153
|
+
entries.push({ path: path2, type: entry.type });
|
|
44154
|
+
if (opts.recursive && entry.type === "dir")
|
|
44155
|
+
nextFrontier.push(path2);
|
|
44156
|
+
}
|
|
44157
|
+
}
|
|
44158
|
+
}
|
|
44159
|
+
frontier = nextFrontier;
|
|
43639
44160
|
}
|
|
43640
|
-
entries = res.entries.map((e2) => ({
|
|
43641
|
-
path: dir ? `${dir}/${e2.name}` : e2.name,
|
|
43642
|
-
type: e2.type
|
|
43643
|
-
}));
|
|
43644
44161
|
} catch (e2) {
|
|
43645
|
-
|
|
44162
|
+
if (e2 instanceof DirectoryPathTooLongError) {
|
|
44163
|
+
process.stderr.write(`error: ${e2.message}
|
|
44164
|
+
`);
|
|
44165
|
+
} else {
|
|
44166
|
+
printTrpcError(e2, host);
|
|
44167
|
+
}
|
|
43646
44168
|
process.exit(EXIT_RUNTIME_FAILURE);
|
|
43647
44169
|
}
|
|
44170
|
+
if (opts.recursive)
|
|
44171
|
+
entries.sort((a, b2) => a.path.localeCompare(b2.path));
|
|
43648
44172
|
const out = opts.json ? `${JSON.stringify(entries)}
|
|
43649
|
-
` : entries.
|
|
44173
|
+
` : entries.map((e2) => `${e2.path}${entrySuffix[e2.type]}
|
|
43650
44174
|
`).join("");
|
|
43651
44175
|
return writeStdoutAndExit(out, EXIT_SUCCESS);
|
|
43652
44176
|
}
|
|
@@ -44260,6 +44784,9 @@ function buildCreateCommand3(deps) {
|
|
|
44260
44784
|
"--session-mode <mode>",
|
|
44261
44785
|
"session strategy each tick (default: fresh)"
|
|
44262
44786
|
).choices(["fresh", "continuous"])
|
|
44787
|
+
).option(
|
|
44788
|
+
"--precheck <command>",
|
|
44789
|
+
"shell command run in the workspace before each fire; exit 0 runs, exit 1 skips this occurrence, any other exit means the check broke and the task runs anyway"
|
|
44263
44790
|
).option(
|
|
44264
44791
|
"--server <url>",
|
|
44265
44792
|
"override the configured server URL for this call"
|
|
@@ -44313,7 +44840,8 @@ function buildCreateCommand3(deps) {
|
|
|
44313
44840
|
timezone,
|
|
44314
44841
|
quietHours,
|
|
44315
44842
|
task: opts.task,
|
|
44316
|
-
...opts.sessionMode ? { sessionMode: opts.sessionMode } : {}
|
|
44843
|
+
...opts.sessionMode ? { sessionMode: opts.sessionMode } : {},
|
|
44844
|
+
...opts.precheck ? { precheck: opts.precheck } : {}
|
|
44317
44845
|
});
|
|
44318
44846
|
if (!result.ok) {
|
|
44319
44847
|
if (result.error.kind === "invalid-input") {
|
|
@@ -44471,6 +44999,7 @@ function renderSchedule(view) {
|
|
|
44471
44999
|
} else {
|
|
44472
45000
|
lines.push(`Cron: ${view.cron ?? ""}`);
|
|
44473
45001
|
}
|
|
45002
|
+
if (view.precheck) lines.push(`Precheck: ${view.precheck}`);
|
|
44474
45003
|
lines.push(`Session: ${view.sessionMode ?? "fresh"}`);
|
|
44475
45004
|
lines.push(`Enabled: ${view.enabled}`);
|
|
44476
45005
|
lines.push(`Created by: ${view.createdBy}`);
|
|
@@ -44479,6 +45008,18 @@ function renderSchedule(view) {
|
|
|
44479
45008
|
if (view.status?.lastResult) {
|
|
44480
45009
|
lines.push(`Last result: ${view.status.lastResult}`);
|
|
44481
45010
|
}
|
|
45011
|
+
if (view.precheck && view.status?.declinedCount) {
|
|
45012
|
+
const when = view.status.lastDeclinedAt ? `, last ${view.status.lastDeclinedAt}` : "";
|
|
45013
|
+
lines.push(
|
|
45014
|
+
`Declined: ${view.status.declinedCount} since the last run${when}`
|
|
45015
|
+
);
|
|
45016
|
+
}
|
|
45017
|
+
if (view.precheck && view.status?.lastPrecheckError) {
|
|
45018
|
+
const inARow = (view.status.precheckFailedCount ?? 0) > 1 ? ` (${view.status.precheckFailedCount} times in a row)` : "";
|
|
45019
|
+
lines.push(
|
|
45020
|
+
`Precheck: failed${inARow} \u2014 ${view.status.lastPrecheckError}`
|
|
45021
|
+
);
|
|
45022
|
+
}
|
|
44482
45023
|
return `${lines.join("\n")}
|
|
44483
45024
|
`;
|
|
44484
45025
|
}
|
|
@@ -44527,7 +45068,7 @@ function buildListCommand6(deps) {
|
|
|
44527
45068
|
"override the configured server URL for this call"
|
|
44528
45069
|
).option("--json", "emit raw JSON instead of the default table").addHelpText(
|
|
44529
45070
|
"after",
|
|
44530
|
-
"\nExamples:\n dam schedule list my-agent\n dam schedule list agent-
|
|
45071
|
+
"\nExamples:\n dam schedule list my-agent\n dam schedule list agent-3f9c2b7e41d08a65 --json\n"
|
|
44531
45072
|
).action(async (ref, opts) => {
|
|
44532
45073
|
const host = await resolveActiveHost(deps, {
|
|
44533
45074
|
flag: opts.server ? { server: opts.server } : void 0,
|
|
@@ -44668,6 +45209,9 @@ function buildUpdateCommand3(deps) {
|
|
|
44668
45209
|
["fresh", "continuous"]
|
|
44669
45210
|
)
|
|
44670
45211
|
).option(
|
|
45212
|
+
"--precheck <command>",
|
|
45213
|
+
"shell command run in the workspace before each fire; exit 0 runs, exit 1 skips this occurrence, any other exit means the check broke and the task runs anyway"
|
|
45214
|
+
).option("--precheck-none", "remove the schedule's precheck").option(
|
|
44671
45215
|
"--server <url>",
|
|
44672
45216
|
"override the configured server URL for this call"
|
|
44673
45217
|
).option("--json", "emit the updated schedule as JSON").addHelpText(
|
|
@@ -44676,10 +45220,10 @@ function buildUpdateCommand3(deps) {
|
|
|
44676
45220
|
).action(async (id, opts) => {
|
|
44677
45221
|
const recurrenceGiven = opts.daily !== void 0 || opts.every !== void 0 || opts.rrule !== void 0;
|
|
44678
45222
|
const quietGiven = opts.quietWindow.length > 0;
|
|
44679
|
-
const anyFlag = opts.name !== void 0 || opts.task !== void 0 || opts.timezone !== void 0 || opts.sessionMode !== void 0 || opts.weekdays !== void 0 || recurrenceGiven || quietGiven;
|
|
45223
|
+
const anyFlag = opts.name !== void 0 || opts.task !== void 0 || opts.timezone !== void 0 || opts.sessionMode !== void 0 || opts.weekdays !== void 0 || opts.precheck !== void 0 || opts.precheckNone === true || recurrenceGiven || quietGiven;
|
|
44680
45224
|
if (!anyFlag) {
|
|
44681
45225
|
process.stderr.write(
|
|
44682
|
-
"error: nothing to update \u2014 pass at least one of --name, --task, --daily/--every/--rrule, --weekdays, --timezone, --quiet-window, --session-mode\n"
|
|
45226
|
+
"error: nothing to update \u2014 pass at least one of --name, --task, --daily/--every/--rrule, --weekdays, --timezone, --quiet-window, --session-mode, --precheck, --precheck-none\n"
|
|
44683
45227
|
);
|
|
44684
45228
|
process.exit(EXIT_INVALID_INPUT);
|
|
44685
45229
|
}
|
|
@@ -44764,7 +45308,8 @@ function buildUpdateCommand3(deps) {
|
|
|
44764
45308
|
timezone: opts.timezone ?? view.timezone ?? detectTimezone(),
|
|
44765
45309
|
quietHours,
|
|
44766
45310
|
task: opts.task ?? view.task ?? "",
|
|
44767
|
-
...sessionMode ? { sessionMode } : {}
|
|
45311
|
+
...sessionMode ? { sessionMode } : {},
|
|
45312
|
+
precheck: opts.precheckNone ? null : opts.precheck ?? view.precheck
|
|
44768
45313
|
});
|
|
44769
45314
|
if (!result.ok) {
|
|
44770
45315
|
if (result.error.kind === "schedule-not-found") {
|
|
@@ -44895,10 +45440,13 @@ function composeScheduleModule(opts) {
|
|
|
44895
45440
|
|
|
44896
45441
|
// src/modules/skill/domain/source-ref.ts
|
|
44897
45442
|
function resolveSourceRef(sources, ref) {
|
|
44898
|
-
|
|
44899
|
-
|
|
44900
|
-
|
|
44901
|
-
|
|
45443
|
+
const byId = sources.find((s) => s.id === ref);
|
|
45444
|
+
if (byId) return byId;
|
|
45445
|
+
const normalized = normalizeGitUrl(ref);
|
|
45446
|
+
if (!normalized) return null;
|
|
45447
|
+
return sources.find(
|
|
45448
|
+
(s) => normalizeGitUrl(s.gitUrl)?.gitUrl === normalized.gitUrl
|
|
45449
|
+
) ?? null;
|
|
44902
45450
|
}
|
|
44903
45451
|
function sourceKind(s) {
|
|
44904
45452
|
if (s.system) return "Platform";
|
|
@@ -45407,13 +45955,9 @@ function trimToUndefined(v2) {
|
|
|
45407
45955
|
|
|
45408
45956
|
// src/modules/skill/domain/source-name.ts
|
|
45409
45957
|
function deriveSourceName(gitUrl) {
|
|
45410
|
-
|
|
45411
|
-
|
|
45412
|
-
|
|
45413
|
-
} catch {
|
|
45414
|
-
return "";
|
|
45415
|
-
}
|
|
45416
|
-
return pathname.replace(/^\//, "").replace(/\/$/, "").replace(/\.git$/, "");
|
|
45958
|
+
const normalized = normalizeGitUrl(gitUrl);
|
|
45959
|
+
if (!normalized) return "";
|
|
45960
|
+
return new URL(normalized.gitUrl).pathname.replace(/^\//, "");
|
|
45417
45961
|
}
|
|
45418
45962
|
|
|
45419
45963
|
// src/modules/skill/commands/source-add.ts
|
|
@@ -45426,28 +45970,41 @@ function buildSourceAddCommand(deps) {
|
|
|
45426
45970
|
"override the configured server URL for this call"
|
|
45427
45971
|
).option("--json", "emit the created SkillSource as JSON").addHelpText(
|
|
45428
45972
|
"after",
|
|
45429
|
-
"\nThe name defaults to the URL path (github.com/acme/skills \u2192 acme/skills);\npass --name to override. Adding a URL that a Platform or Agent source already\nuses shadows it \u2014 removing your source re-exposes the original.\n\nExamples:\n dam skill source add https://github.com/anthropics/skills\n dam skill source add https://github.com/acme/skills --name acme\n dam skill source add https://github.com/acme/monorepo --path .claude/skills\n"
|
|
45973
|
+
"\nThe URL may be written any usual way \u2014 with or without https://, with a\n.git suffix or a trailing slash, or copied from the address bar including\n/tree/<branch>/<dir>, whose directory becomes the source path.\n\nThe name defaults to the URL path (github.com/acme/skills \u2192 acme/skills);\npass --name to override. Adding a URL that a Platform or Agent source already\nuses shadows it \u2014 removing your source re-exposes the original.\n\nExamples:\n dam skill source add https://github.com/anthropics/skills\n dam skill source add https://github.com/acme/skills --name acme\n dam skill source add https://github.com/acme/monorepo --path .claude/skills\n"
|
|
45430
45974
|
).action(
|
|
45431
45975
|
async (gitUrl, opts) => {
|
|
45432
45976
|
const json2 = opts.json ?? false;
|
|
45433
|
-
|
|
45434
|
-
|
|
45435
|
-
|
|
45436
|
-
|
|
45437
|
-
`
|
|
45977
|
+
const normalized = normalizeGitUrl(gitUrl);
|
|
45978
|
+
if (!normalized) {
|
|
45979
|
+
process.stderr.write(
|
|
45980
|
+
`error: '${gitUrl}' is not a repository URL \u2014 expected something like https://github.com/owner/repo
|
|
45981
|
+
`
|
|
45982
|
+
);
|
|
45438
45983
|
process.exit(EXIT_INVALID_INPUT);
|
|
45439
45984
|
}
|
|
45440
|
-
|
|
45441
|
-
|
|
45985
|
+
if (!json2 && normalized.ref !== void 0) {
|
|
45986
|
+
process.stderr.write(
|
|
45987
|
+
`note: branch '${normalized.ref}' in the URL is ignored \u2014 skills are read from the repository default branch
|
|
45988
|
+
`
|
|
45989
|
+
);
|
|
45990
|
+
}
|
|
45991
|
+
if (!json2 && normalized.path !== void 0 && opts.path === void 0) {
|
|
45992
|
+
process.stderr.write(
|
|
45993
|
+
`note: scanning '${normalized.path}' from the URL; pass --path to override
|
|
45994
|
+
`
|
|
45995
|
+
);
|
|
45996
|
+
}
|
|
45997
|
+
const name = await resolveName(normalized.gitUrl, opts.name, json2);
|
|
45998
|
+
const nameCheck = skillCreateSourceFieldsSchema.shape.name.safeParse(name);
|
|
45442
45999
|
if (!nameCheck.success) {
|
|
45443
46000
|
const msg = nameCheck.error.issues[0]?.message ?? "invalid name";
|
|
45444
46001
|
process.stderr.write(`error: ${msg}
|
|
45445
46002
|
`);
|
|
45446
46003
|
process.exit(EXIT_INVALID_INPUT);
|
|
45447
46004
|
}
|
|
45448
|
-
let path2;
|
|
46005
|
+
let path2 = normalized.path;
|
|
45449
46006
|
if (opts.path !== void 0) {
|
|
45450
|
-
const pathCheck =
|
|
46007
|
+
const pathCheck = skillCreateSourceFieldsSchema.shape.path.safeParse(
|
|
45451
46008
|
opts.path
|
|
45452
46009
|
);
|
|
45453
46010
|
if (!pathCheck.success) {
|
|
@@ -45465,7 +46022,7 @@ function buildSourceAddCommand(deps) {
|
|
|
45465
46022
|
belowFloor: EXIT_BELOW_FLOOR
|
|
45466
46023
|
}
|
|
45467
46024
|
});
|
|
45468
|
-
const result = await deps.createSkillsService(host).addSource({ name, gitUrl, path: path2 });
|
|
46025
|
+
const result = await deps.createSkillsService(host).addSource({ name, gitUrl: normalized.gitUrl, path: path2 });
|
|
45469
46026
|
if (!result.ok) {
|
|
45470
46027
|
if (result.error.kind === "source-exists") {
|
|
45471
46028
|
process.stderr.write(
|
|
@@ -46522,7 +47079,7 @@ function buildMetricsCommand(deps) {
|
|
|
46522
47079
|
"override the configured server URL for this call"
|
|
46523
47080
|
).option("--json", "emit raw JSON instead of the default report").addHelpText(
|
|
46524
47081
|
"after",
|
|
46525
|
-
"\nExamples:\n dam metrics my-agent\n dam metrics my-agent --session sess-abc123\n dam metrics agent-
|
|
47082
|
+
"\nExamples:\n dam metrics my-agent\n dam metrics my-agent --session sess-abc123\n dam metrics agent-3f9c2b7e41d08a65 --since 168 --json\n"
|
|
46526
47083
|
).action(
|
|
46527
47084
|
async (ref, opts) => {
|
|
46528
47085
|
const host = await resolveActiveHost(deps, {
|
|
@@ -46549,12 +47106,12 @@ function buildMetricsCommand(deps) {
|
|
|
46549
47106
|
sessions.value.filter((s) => s.title).map((s) => [s.sessionId, s.title])
|
|
46550
47107
|
);
|
|
46551
47108
|
};
|
|
46552
|
-
const
|
|
47109
|
+
const sinceHours2 = opts.since ? Number(opts.since) : void 0;
|
|
46553
47110
|
const [result, titles] = await Promise.all([
|
|
46554
47111
|
deps.createMetricsService(host).overview({
|
|
46555
47112
|
agentId: agent.id,
|
|
46556
47113
|
sessionId: opts.session,
|
|
46557
|
-
sinceHours,
|
|
47114
|
+
sinceHours: sinceHours2,
|
|
46558
47115
|
limit: opts.limit ? Number(opts.limit) : 100
|
|
46559
47116
|
}),
|
|
46560
47117
|
fetchTitles().catch(() => /* @__PURE__ */ new Map())
|
|
@@ -46570,14 +47127,14 @@ function buildMetricsCommand(deps) {
|
|
|
46570
47127
|
}));
|
|
46571
47128
|
const windowLabel = [
|
|
46572
47129
|
opts.session && `session ${opts.session}`,
|
|
46573
|
-
|
|
47130
|
+
sinceHours2 !== void 0 && `last ${sinceHours2}h`
|
|
46574
47131
|
].filter(Boolean).join(" \xB7 ") || "all time";
|
|
46575
47132
|
if (opts.json) {
|
|
46576
47133
|
return writeStdoutAndExit(
|
|
46577
47134
|
`${JSON.stringify({
|
|
46578
47135
|
agentId: agent.id,
|
|
46579
47136
|
sessionId: opts.session,
|
|
46580
|
-
sinceHours,
|
|
47137
|
+
sinceHours: sinceHours2,
|
|
46581
47138
|
tokenSpendByModel,
|
|
46582
47139
|
runtimeBySession,
|
|
46583
47140
|
contextPerCall
|
|
@@ -46713,6 +47270,251 @@ function composeMetricsModule(opts) {
|
|
|
46713
47270
|
};
|
|
46714
47271
|
}
|
|
46715
47272
|
|
|
47273
|
+
// src/modules/telemetry/commands/telemetry.ts
|
|
47274
|
+
var DEFAULT_SINCE_HOURS = TELEMETRY_DEFAULT_SINCE_HOURS;
|
|
47275
|
+
var EXPORT_SINCE_HOURS = TELEMETRY_MAX_SINCE_HOURS;
|
|
47276
|
+
var InvalidSinceError = class extends Error {
|
|
47277
|
+
};
|
|
47278
|
+
function sinceHoursOf(raw, fallback) {
|
|
47279
|
+
if (raw === void 0) return fallback;
|
|
47280
|
+
const hours = Number(raw);
|
|
47281
|
+
if (!Number.isFinite(hours) || hours <= 0 || hours > TELEMETRY_MAX_SINCE_HOURS) {
|
|
47282
|
+
throw new InvalidSinceError(
|
|
47283
|
+
`--since must be a positive number of hours up to ${TELEMETRY_MAX_SINCE_HOURS}, got "${raw}"`
|
|
47284
|
+
);
|
|
47285
|
+
}
|
|
47286
|
+
return hours;
|
|
47287
|
+
}
|
|
47288
|
+
var secs2 = (ms) => `${(ms / 1e3).toFixed(1)}s`;
|
|
47289
|
+
var usd = (n) => n > 0 && n < 0.01 ? "<$0.01" : `$${n.toFixed(2)}`;
|
|
47290
|
+
async function hostAndAgent(deps, ref, server) {
|
|
47291
|
+
const host = await resolveActiveHost(deps, {
|
|
47292
|
+
flag: server ? { server } : void 0,
|
|
47293
|
+
exitCodes: {
|
|
47294
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
47295
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
47296
|
+
}
|
|
47297
|
+
});
|
|
47298
|
+
const resolved = await createAgentResolver({
|
|
47299
|
+
agentService: deps.createAgentService(host)
|
|
47300
|
+
}).resolve(ref);
|
|
47301
|
+
if (!resolved.ok) {
|
|
47302
|
+
printResolveError(resolved.error, host);
|
|
47303
|
+
process.exit(exitCodeForResolveError(resolved.error));
|
|
47304
|
+
}
|
|
47305
|
+
return { host, agent: resolved.value };
|
|
47306
|
+
}
|
|
47307
|
+
function buildTelemetryCommand(deps) {
|
|
47308
|
+
const telemetry = new Command("telemetry").description(
|
|
47309
|
+
"Read an Agent's session telemetry \u2014 the turns it ran, and the records behind them"
|
|
47310
|
+
);
|
|
47311
|
+
telemetry.command("show", { isDefault: true }).description("List the turns a session ran, with their cost and shape").argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").requiredOption("--session <id>", "the session to read").option(
|
|
47312
|
+
"--since <hours>",
|
|
47313
|
+
`lookback window in hours (max ${TELEMETRY_MAX_SINCE_HOURS}; default ${DEFAULT_SINCE_HOURS})`
|
|
47314
|
+
).option(
|
|
47315
|
+
"--server <url>",
|
|
47316
|
+
"override the configured server URL for this call"
|
|
47317
|
+
).option("--json", "emit raw JSON instead of the default report").addHelpText(
|
|
47318
|
+
"after",
|
|
47319
|
+
"\nExamples:\n dam telemetry my-agent --session sess-abc123\n dam telemetry my-agent --session sess-abc123 --since 168 --json\n"
|
|
47320
|
+
).action(
|
|
47321
|
+
async (ref, opts) => {
|
|
47322
|
+
const { host, agent } = await hostAndAgent(deps, ref, opts.server);
|
|
47323
|
+
let sinceHours2;
|
|
47324
|
+
try {
|
|
47325
|
+
sinceHours2 = sinceHoursOf(opts.since, DEFAULT_SINCE_HOURS);
|
|
47326
|
+
} catch (err3) {
|
|
47327
|
+
process.stderr.write(`${err3.message}
|
|
47328
|
+
`);
|
|
47329
|
+
return process.exit(EXIT_INVALID_INPUT);
|
|
47330
|
+
}
|
|
47331
|
+
const result = await deps.createTelemetryService(host).turns({
|
|
47332
|
+
agentId: agent.id,
|
|
47333
|
+
sessionId: opts.session,
|
|
47334
|
+
sinceHours: sinceHours2,
|
|
47335
|
+
limit: 100,
|
|
47336
|
+
spanLimit: 1e3,
|
|
47337
|
+
logLimit: 1e3
|
|
47338
|
+
});
|
|
47339
|
+
if (!result.ok) {
|
|
47340
|
+
printServiceError(result.error, host);
|
|
47341
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
47342
|
+
}
|
|
47343
|
+
if (!result.value.available) {
|
|
47344
|
+
process.stderr.write(`${result.value.reason}
|
|
47345
|
+
`);
|
|
47346
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
47347
|
+
}
|
|
47348
|
+
const { turns } = result.value;
|
|
47349
|
+
if (opts.json) {
|
|
47350
|
+
return writeStdoutAndExit(
|
|
47351
|
+
`${JSON.stringify({
|
|
47352
|
+
agentId: agent.id,
|
|
47353
|
+
sessionId: opts.session,
|
|
47354
|
+
sinceHours: sinceHours2,
|
|
47355
|
+
turns
|
|
47356
|
+
})}
|
|
47357
|
+
`,
|
|
47358
|
+
EXIT_SUCCESS
|
|
47359
|
+
);
|
|
47360
|
+
}
|
|
47361
|
+
if (turns.length === 0) {
|
|
47362
|
+
process.stderr.write(
|
|
47363
|
+
`No telemetry for ${agent.name} in session ${opts.session} over the last ${sinceHours2}h.
|
|
47364
|
+
`
|
|
47365
|
+
);
|
|
47366
|
+
return process.exit(EXIT_SUCCESS);
|
|
47367
|
+
}
|
|
47368
|
+
return writeStdoutAndExit(
|
|
47369
|
+
renderTable([
|
|
47370
|
+
["started", "duration", "calls", "spans", "records", "cost"],
|
|
47371
|
+
...turns.map((t) => [
|
|
47372
|
+
t.startedAt,
|
|
47373
|
+
secs2(t.durationMs),
|
|
47374
|
+
String(t.calls),
|
|
47375
|
+
String(t.spanCount),
|
|
47376
|
+
String(t.recordCount),
|
|
47377
|
+
t.costUsd > 0 ? usd(t.costUsd) : "\u2014"
|
|
47378
|
+
])
|
|
47379
|
+
]),
|
|
47380
|
+
EXIT_SUCCESS
|
|
47381
|
+
);
|
|
47382
|
+
}
|
|
47383
|
+
);
|
|
47384
|
+
telemetry.command("export").description(
|
|
47385
|
+
"Write a session's telemetry to stdout as newline-delimited JSON"
|
|
47386
|
+
).argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").option("--session <id>", "narrow to one session").option("--signal <signal>", "'logs' or 'spans' (default: logs)", "logs").option(
|
|
47387
|
+
"--since <hours>",
|
|
47388
|
+
`lookback window in hours (max ${TELEMETRY_MAX_SINCE_HOURS}; default ${EXPORT_SINCE_HOURS})`
|
|
47389
|
+
).option(
|
|
47390
|
+
"--server <url>",
|
|
47391
|
+
"override the configured server URL for this call"
|
|
47392
|
+
).addHelpText(
|
|
47393
|
+
"after",
|
|
47394
|
+
"\nExamples:\n dam telemetry export my-agent --session sess-abc123 > telemetry.ndjson\n dam telemetry export my-agent --signal spans | jq -s 'group_by(.name)'\n"
|
|
47395
|
+
).action(
|
|
47396
|
+
async (ref, opts) => {
|
|
47397
|
+
if (opts.signal !== "logs" && opts.signal !== "spans") {
|
|
47398
|
+
process.stderr.write("--signal must be 'logs' or 'spans'\n");
|
|
47399
|
+
return process.exit(EXIT_INVALID_INPUT);
|
|
47400
|
+
}
|
|
47401
|
+
const { host, agent } = await hostAndAgent(deps, ref, opts.server);
|
|
47402
|
+
let sinceHours2;
|
|
47403
|
+
try {
|
|
47404
|
+
sinceHours2 = sinceHoursOf(opts.since, EXPORT_SINCE_HOURS);
|
|
47405
|
+
} catch (err3) {
|
|
47406
|
+
process.stderr.write(`${err3.message}
|
|
47407
|
+
`);
|
|
47408
|
+
return process.exit(EXIT_INVALID_INPUT);
|
|
47409
|
+
}
|
|
47410
|
+
const outcome = await deps.createExportClient(host).run({
|
|
47411
|
+
agentId: agent.id,
|
|
47412
|
+
...opts.session === void 0 ? {} : { sessionId: opts.session },
|
|
47413
|
+
signal: opts.signal,
|
|
47414
|
+
sinceHours: sinceHours2
|
|
47415
|
+
});
|
|
47416
|
+
if (outcome.kind === "failed") {
|
|
47417
|
+
process.stderr.write(
|
|
47418
|
+
`Export failed (${outcome.status}): ${outcome.reason}
|
|
47419
|
+
`
|
|
47420
|
+
);
|
|
47421
|
+
return process.exit(EXIT_RUNTIME_FAILURE);
|
|
47422
|
+
}
|
|
47423
|
+
if (outcome.truncated) {
|
|
47424
|
+
process.stderr.write(
|
|
47425
|
+
"Export hit the row cap \u2014 narrow --since or --session for the rest.\n"
|
|
47426
|
+
);
|
|
47427
|
+
}
|
|
47428
|
+
return writeStdoutAndExit(outcome.body, EXIT_SUCCESS);
|
|
47429
|
+
}
|
|
47430
|
+
);
|
|
47431
|
+
return telemetry;
|
|
47432
|
+
}
|
|
47433
|
+
|
|
47434
|
+
// src/modules/telemetry/infrastructure/export-client.ts
|
|
47435
|
+
function exportPath(req) {
|
|
47436
|
+
const params = new URLSearchParams({
|
|
47437
|
+
agentId: req.agentId,
|
|
47438
|
+
signal: req.signal,
|
|
47439
|
+
sinceHours: String(req.sinceHours)
|
|
47440
|
+
});
|
|
47441
|
+
if (req.sessionId !== void 0) params.set("sessionId", req.sessionId);
|
|
47442
|
+
return `/api/telemetry/export?${params.toString()}`;
|
|
47443
|
+
}
|
|
47444
|
+
function createExportClient(deps) {
|
|
47445
|
+
const doFetch = deps.fetch ?? globalThis.fetch;
|
|
47446
|
+
return {
|
|
47447
|
+
async run(req) {
|
|
47448
|
+
const token = await deps.getToken();
|
|
47449
|
+
if (token === null) {
|
|
47450
|
+
return { kind: "failed", status: 401, reason: "not logged in" };
|
|
47451
|
+
}
|
|
47452
|
+
const res = await doFetch(
|
|
47453
|
+
new URL(exportPath(req), deps.host).toString(),
|
|
47454
|
+
{
|
|
47455
|
+
headers: { authorization: `Bearer ${token}` }
|
|
47456
|
+
}
|
|
47457
|
+
);
|
|
47458
|
+
if (!res.ok) {
|
|
47459
|
+
return {
|
|
47460
|
+
kind: "failed",
|
|
47461
|
+
status: res.status,
|
|
47462
|
+
reason: await failureReason(res)
|
|
47463
|
+
};
|
|
47464
|
+
}
|
|
47465
|
+
return {
|
|
47466
|
+
kind: "ok",
|
|
47467
|
+
body: await res.text(),
|
|
47468
|
+
truncated: res.headers.get("x-platform-truncated") === "true"
|
|
47469
|
+
};
|
|
47470
|
+
}
|
|
47471
|
+
};
|
|
47472
|
+
}
|
|
47473
|
+
async function failureReason(res) {
|
|
47474
|
+
try {
|
|
47475
|
+
const body = await res.json();
|
|
47476
|
+
if (typeof body === "object" && body !== null && typeof body.error === "string") {
|
|
47477
|
+
return body.error;
|
|
47478
|
+
}
|
|
47479
|
+
} catch {
|
|
47480
|
+
return res.statusText;
|
|
47481
|
+
}
|
|
47482
|
+
return res.statusText;
|
|
47483
|
+
}
|
|
47484
|
+
|
|
47485
|
+
// src/modules/telemetry/services/telemetry-service.ts
|
|
47486
|
+
function createTelemetryService(deps) {
|
|
47487
|
+
return {
|
|
47488
|
+
async turns(query) {
|
|
47489
|
+
return trpcCall(() => deps.trpc.telemetry.turns.query(query));
|
|
47490
|
+
}
|
|
47491
|
+
};
|
|
47492
|
+
}
|
|
47493
|
+
|
|
47494
|
+
// src/modules/telemetry/compose.ts
|
|
47495
|
+
function composeTelemetryModule(opts) {
|
|
47496
|
+
return {
|
|
47497
|
+
commands: [
|
|
47498
|
+
buildTelemetryCommand({
|
|
47499
|
+
compatService: opts.compatService,
|
|
47500
|
+
configService: opts.configService,
|
|
47501
|
+
tokenProvider: opts.tokenProvider,
|
|
47502
|
+
createAgentService: opts.createAgentService,
|
|
47503
|
+
createTelemetryService: (host) => createTelemetryService({
|
|
47504
|
+
trpc: createTrpcClient({ host, tokenProvider: opts.tokenProvider })
|
|
47505
|
+
}),
|
|
47506
|
+
createExportClient: (host) => createExportClient({
|
|
47507
|
+
host,
|
|
47508
|
+
getToken: async () => {
|
|
47509
|
+
const token = await opts.tokenProvider.getValidAccessToken(host);
|
|
47510
|
+
return token.ok ? token.value : null;
|
|
47511
|
+
}
|
|
47512
|
+
})
|
|
47513
|
+
})
|
|
47514
|
+
]
|
|
47515
|
+
};
|
|
47516
|
+
}
|
|
47517
|
+
|
|
46716
47518
|
// src/modules/template/commands/list.ts
|
|
46717
47519
|
var DESCRIPTION_MAX = 60;
|
|
46718
47520
|
function buildListCommand8(deps) {
|
|
@@ -47147,6 +47949,12 @@ function compose(opts = {}) {
|
|
|
47147
47949
|
compatService: cli.services.compatService,
|
|
47148
47950
|
createAgentService: agent.exports.createService
|
|
47149
47951
|
});
|
|
47952
|
+
const telemetry = composeTelemetryModule({
|
|
47953
|
+
tokenProvider: auth.exports.tokenProvider,
|
|
47954
|
+
configService: cli.services.configService,
|
|
47955
|
+
compatService: cli.services.compatService,
|
|
47956
|
+
createAgentService: agent.exports.createService
|
|
47957
|
+
});
|
|
47150
47958
|
const terms = composeTermsModule({
|
|
47151
47959
|
tokenProvider: auth.exports.tokenProvider,
|
|
47152
47960
|
configService: cli.services.configService,
|
|
@@ -47169,6 +47977,7 @@ function compose(opts = {}) {
|
|
|
47169
47977
|
for (const command of ssh.commands) program3.addCommand(command);
|
|
47170
47978
|
for (const command of channel.commands) program3.addCommand(command);
|
|
47171
47979
|
for (const command of metrics.commands) program3.addCommand(command);
|
|
47980
|
+
for (const command of telemetry.commands) program3.addCommand(command);
|
|
47172
47981
|
for (const command of terms.commands) program3.addCommand(command);
|
|
47173
47982
|
return program3;
|
|
47174
47983
|
}
|
|
@@ -47198,9 +48007,9 @@ try {
|
|
|
47198
48007
|
@trpc/client/dist/httpBatchLink-CaWjh1oW.mjs:
|
|
47199
48008
|
(* istanbul ignore if -- @preserve *)
|
|
47200
48009
|
|
|
48010
|
+
smol-toml/dist/date.js:
|
|
47201
48011
|
smol-toml/dist/error.js:
|
|
47202
48012
|
smol-toml/dist/util.js:
|
|
47203
|
-
smol-toml/dist/date.js:
|
|
47204
48013
|
smol-toml/dist/primitive.js:
|
|
47205
48014
|
smol-toml/dist/extract.js:
|
|
47206
48015
|
smol-toml/dist/struct.js:
|