@knowttl/artium-axi 0.0.37 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/bin/artium-axi.mjs +163 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ artium-axi falcon-axi detection list
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
Login prompts privately for a password; replace the synthetic account and choose a tool granted to you.
|
|
41
|
+
If the tool has several instances, choose one from `tools show` and run `artium-axi --instance <name> falcon-axi detection list`.
|
|
41
42
|
For SSO, use `artium-axi login --sso` and approve only your terminal's browser code.
|
|
42
43
|
For a private CA, set `ARTIUM_AXI_CA_FILE` to a readable PEM file before login.
|
|
43
44
|
Login saves connection settings; shared service credentials and tool profiles are configured by administrators.
|
|
@@ -56,7 +57,7 @@ artium-axi setup --host opencode --hook
|
|
|
56
57
|
Choose your host's command; omit `--hook` to install skills only, including `--host pi`.
|
|
57
58
|
Claude Code and Codex use `SessionStart`; OpenCode 1.19.x uses a local plugin to add context before model requests.
|
|
58
59
|
Codex requires hooks enabled and host approval of the installed hook; setup preserves those trust and administrator controls.
|
|
59
|
-
Ambient context contains current tool names, status
|
|
60
|
+
Ambient context contains current tool names, status, read/write posture and instance counts, with explicit authentication or connectivity failure disclosure and no identity or session metadata.
|
|
60
61
|
Skills teach managed command discovery and grant no permissions.
|
|
61
62
|
Artium's authenticated setup fetches granted tools' adapted skills; a standalone skill installer does not configure this server account.
|
|
62
63
|
Start with the [compact investigation guide](skill/artium-axi/SKILL.md#investigation-quick-guide) in the base skill.
|
|
@@ -177,7 +178,7 @@ Installation details live in the [client reference](docs/client-reference.md#ver
|
|
|
177
178
|
## Contributing
|
|
178
179
|
|
|
179
180
|
Use Linux and follow [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).
|
|
180
|
-
Development
|
|
181
|
+
Development validation runs locally through no-mistakes with fakes and synthetic identities; see [container acceptance](CONTRIBUTING.md#container-acceptance) for release checks.
|
|
181
182
|
|
|
182
183
|
## Security
|
|
183
184
|
|
package/bin/artium-axi.mjs
CHANGED
|
@@ -43,7 +43,7 @@ var init_package = __esm({
|
|
|
43
43
|
"package.json"() {
|
|
44
44
|
package_default = {
|
|
45
45
|
name: "artium-axi",
|
|
46
|
-
version: "0.0.
|
|
46
|
+
version: "0.0.38",
|
|
47
47
|
private: true,
|
|
48
48
|
license: "MIT",
|
|
49
49
|
type: "module",
|
|
@@ -22039,6 +22039,16 @@ var init_errors3 = __esm({
|
|
|
22039
22039
|
}
|
|
22040
22040
|
});
|
|
22041
22041
|
|
|
22042
|
+
// src/shared/instance.ts
|
|
22043
|
+
var instanceNameSchema;
|
|
22044
|
+
var init_instance = __esm({
|
|
22045
|
+
"src/shared/instance.ts"() {
|
|
22046
|
+
"use strict";
|
|
22047
|
+
init_zod();
|
|
22048
|
+
instanceNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,31}$/);
|
|
22049
|
+
}
|
|
22050
|
+
});
|
|
22051
|
+
|
|
22042
22052
|
// src/shared/kubernetes.ts
|
|
22043
22053
|
function resolveKubernetesHostedCommand(args2) {
|
|
22044
22054
|
let prefix2 = 0;
|
|
@@ -22096,6 +22106,7 @@ var init_kubernetes = __esm({
|
|
|
22096
22106
|
"use strict";
|
|
22097
22107
|
init_zod();
|
|
22098
22108
|
init_errors3();
|
|
22109
|
+
init_instance();
|
|
22099
22110
|
kubernetesHostedCommands = [
|
|
22100
22111
|
"workspace create <directory>",
|
|
22101
22112
|
"workspace show <id>",
|
|
@@ -22139,12 +22150,14 @@ var init_kubernetes = __esm({
|
|
|
22139
22150
|
}).passthrough();
|
|
22140
22151
|
kubernetesWorkspaceManifest = external_exports.strictObject({
|
|
22141
22152
|
files: external_exports.array(kubernetesFile).min(1).max(100),
|
|
22142
|
-
lifetimeSeconds: external_exports.number().int().min(1).max(1800).default(300)
|
|
22153
|
+
lifetimeSeconds: external_exports.number().int().min(1).max(1800).default(300),
|
|
22154
|
+
instance: instanceNameSchema.optional()
|
|
22143
22155
|
});
|
|
22144
22156
|
kubernetesSessionStart = external_exports.strictObject({
|
|
22145
22157
|
kind: kubernetesSessionKind,
|
|
22146
22158
|
argv: external_exports.array(external_exports.string().max(8192)).min(1).max(256),
|
|
22147
22159
|
workspace: external_exports.uuid().optional(),
|
|
22160
|
+
instance: instanceNameSchema.optional(),
|
|
22148
22161
|
stdinBase64: external_exports.string().max(4 * Math.ceil(512 * 1024 / 3)).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).optional(),
|
|
22149
22162
|
inputArtifact: external_exports.strictObject({ workspace: external_exports.uuid(), path: kubernetesWorkspacePath }).optional(),
|
|
22150
22163
|
limits: external_exports.strictObject({
|
|
@@ -46084,7 +46097,7 @@ function transferRoutesFor(tool) {
|
|
|
46084
46097
|
function decodedFileBytes(value) {
|
|
46085
46098
|
return value.length / 4 * 3 - (value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0);
|
|
46086
46099
|
}
|
|
46087
|
-
var inputLimits, transferLimits, transferWarning, sha256Schema, sampleSha256Schema, reportIdSchema, transferOwnerIdSchema, mailSelectorSchema, transferSelectionSchema, transferPrepareSchema, transferIdSchema, transferScopeSchema, transferPreviewSchema, transferExecuteSchema, transferRetrieveSchema, transferOutcomeSchema, transferSaveOutcomeSchema, transferArchiveSchema, transferReceiptSchema, transferEvidenceSchema, transferStatusSchema, transferRoutes, transferAuditSchema, byteLength, passwordSchema, passwordChangeSchema, loginSchema, refreshSchema, reauthSchema, reauthResponseSchema, loginResponseSchema, deviceUserCodeSchema, devicePollSchema, deviceStartResponseSchema, devicePollResponseSchema, ssoReauthSchema, ssoReauthResponseSchema, accountId, toolSchema, delegationScopeSchema, meResponseSchema, createDelegationSchema, delegatedExchangeSchema, createdDelegationSchema, skillsResponseSchema, adminUserSchema, adminPageQuerySchema, adminUsersQuerySchema, adminUsersResponseSchema, adminUserDetailSchema, adminUserCreateSchema, adminUserPatchSchema, adminUserUnlockSchema, adminUserResetSchema, adminUserParamsSchema, userSessionsSchema, sessionParamsSchema, emptyInputSchema, revokedSchema, adminUserRoutes, text, auditCursorSchema, auditFiltersSchema, orderedAuditRange, adminAuditQuerySchema, adminAuditExportRoute, adminAuditRecordSchema, adminAuditRoute, falconRtrSettingsSchema, ghWriteOperations, falconWriteOperations, unifiWriteOperations, proxmoxWriteOperations, technitiumWriteOperations, nativeSettingsSchemas, diagnosticSchema, healthSchema, toolWriteStateSchema, writeAccessInputSchema, adminToolSchema, adminCredentialSchema, adminToolParamsSchema,
|
|
46100
|
+
var inputLimits, transferLimits, transferWarning, sha256Schema, sampleSha256Schema, reportIdSchema, transferOwnerIdSchema, mailSelectorSchema, transferSelectionSchema, transferPrepareSchema, transferPrepareRequestSchema, transferIdSchema, transferScopeSchema, transferPreviewSchema, transferExecuteSchema, transferRetrieveSchema, transferOutcomeSchema, transferSaveOutcomeSchema, transferArchiveSchema, transferReceiptSchema, transferEvidenceSchema, transferStatusSchema, transferRoutes, transferAuditSchema, byteLength, passwordSchema, passwordChangeSchema, loginSchema, refreshSchema, reauthSchema, reauthResponseSchema, loginResponseSchema, deviceUserCodeSchema, devicePollSchema, deviceStartResponseSchema, devicePollResponseSchema, ssoReauthSchema, ssoReauthResponseSchema, accountId, toolSchema, delegationScopeSchema, meResponseSchema, createDelegationSchema, delegatedExchangeSchema, createdDelegationSchema, skillsResponseSchema, adminUserSchema, adminPageQuerySchema, adminUsersQuerySchema, adminUsersResponseSchema, adminUserDetailSchema, adminUserCreateSchema, adminUserPatchSchema, adminUserUnlockSchema, adminUserResetSchema, adminUserParamsSchema, userSessionsSchema, sessionParamsSchema, emptyInputSchema, revokedSchema, adminUserRoutes, text, auditCursorSchema, auditFiltersSchema, orderedAuditRange, adminAuditQuerySchema, adminAuditExportRoute, adminAuditRecordSchema, adminAuditRoute, falconRtrSettingsSchema, ghWriteOperations, falconWriteOperations, unifiWriteOperations, proxmoxWriteOperations, technitiumWriteOperations, nativeSettingsSchemas, diagnosticSchema, healthSchema, toolWriteStateSchema, writeAccessInputSchema, adminToolSchema, adminCredentialSchema, adminToolParamsSchema, adminInstanceParamsSchema, adminInstanceSchema, certificateDetailsSchema, certificateInspectionSchema, trustedCredentialCertificateSchema, adminCertificateRoutes, githubConnectionInput, githubDeviceRoutes, adminToolRoutes, instanceBase, instanceRevisions, adminInstanceRoutes, oidcIssuerSchema, providerSettings, entraSettings, oidcSettings, providerSettingsSchema, providerFields, adminProviderSchema, adminProviderCredentialSchema, adminProviderRoutes, roleRuleSettingsSchema, adminRoleRuleSchema, adminRoleRuleRoutes, invitationLifetimeSchema, adminInvitationSchema, invitationLinkSchema, adminInvitationRoutes, adminRoleSchema, adminRolesResponseSchema, adminRoleRoutes, adminRoleToolParamsSchema, toolsResponseSchema, inputFileSchema, runInputSchema, runRequestSchema, counts, runSuccessSchema, errorResponseSchema, runResponseSchema;
|
|
46088
46101
|
var init_api2 = __esm({
|
|
46089
46102
|
"src/shared/api.ts"() {
|
|
46090
46103
|
"use strict";
|
|
@@ -46099,6 +46112,8 @@ var init_api2 = __esm({
|
|
|
46099
46112
|
init_unifi_axi();
|
|
46100
46113
|
init_proxmox_axi();
|
|
46101
46114
|
init_technitium_axi();
|
|
46115
|
+
init_instance();
|
|
46116
|
+
init_instance();
|
|
46102
46117
|
inputLimits = {
|
|
46103
46118
|
requestBytes: 16 * 1024 * 1024,
|
|
46104
46119
|
arguments: 64,
|
|
@@ -46150,11 +46165,13 @@ var init_api2 = __esm({
|
|
|
46150
46165
|
external_exports.strictObject({ operation: external_exports.literal("mail.attachment.save"), selector: mailSelectorSchema(3), type: external_exports.literal("attachment") })
|
|
46151
46166
|
]);
|
|
46152
46167
|
transferPrepareSchema = external_exports.strictObject({ selection: transferSelectionSchema, targetDigest: sha256Schema });
|
|
46168
|
+
transferPrepareRequestSchema = transferPrepareSchema.extend({ instance: instanceNameSchema.optional() });
|
|
46153
46169
|
transferIdSchema = external_exports.uuid();
|
|
46154
46170
|
transferScopeSchema = external_exports.strictObject({
|
|
46155
46171
|
transferId: transferIdSchema,
|
|
46156
46172
|
userId: transferOwnerIdSchema,
|
|
46157
46173
|
sessionFamilyId: transferOwnerIdSchema,
|
|
46174
|
+
credentialId: external_exports.string().min(1),
|
|
46158
46175
|
credentialRevision: external_exports.number().int().positive(),
|
|
46159
46176
|
selection: transferSelectionSchema,
|
|
46160
46177
|
targetDigest: sha256Schema,
|
|
@@ -46204,7 +46221,7 @@ var init_api2 = __esm({
|
|
|
46204
46221
|
}).refine((evidence) => !["ready", "delivery-completed"].includes(evidence.outcome) || evidence.archive !== null).refine((evidence) => !["preview", "denied-not-sent", "native-outcome-unknown", "upstream-failure"].includes(evidence.outcome) || evidence.archive === null).refine((evidence) => evidence.saveOutcome !== "verified-save" || evidence.archive !== null);
|
|
46205
46222
|
transferStatusSchema = transferEvidenceSchema.safeExtend({ transferId: transferIdSchema, expiresAt: external_exports.number().int() });
|
|
46206
46223
|
transferRoutes = {
|
|
46207
|
-
prepare: { method: "POST", path: "/v1/transfers/hybrid/prepare", input:
|
|
46224
|
+
prepare: { method: "POST", path: "/v1/transfers/hybrid/prepare", input: transferPrepareRequestSchema, response: transferPreviewSchema },
|
|
46208
46225
|
execute: { method: "POST", path: "/v1/transfers/hybrid/execute", input: transferExecuteSchema, response: transferStatusSchema },
|
|
46209
46226
|
retrieve: { method: "POST", path: "/v1/transfers/hybrid/retrieve", input: transferRetrieveSchema },
|
|
46210
46227
|
receipt: { method: "POST", path: "/v1/transfers/hybrid/receipt", input: transferReceiptSchema },
|
|
@@ -46268,7 +46285,11 @@ var init_api2 = __esm({
|
|
|
46268
46285
|
accountId = external_exports.string().min(1);
|
|
46269
46286
|
toolSchema = external_exports.enum(["falcon-axi", "vectra-axi", "az-axi", "mg-axi", "ldap-axi", "ado-axi", "awx-axi", "tenable-axi", "hybrid-axi", "checkpoint-axi", "beyondtrust-axi", "gh-axi", "unifi-axi", "proxmox-axi", "technitium-axi", "shodan-axi", "gitea-axi", "kubernetes-axi", "ssh-axi"]);
|
|
46270
46287
|
delegationScopeSchema = external_exports.strictObject({
|
|
46271
|
-
tools: external_exports.array(external_exports.strictObject({
|
|
46288
|
+
tools: external_exports.array(external_exports.strictObject({
|
|
46289
|
+
tool: toolSchema,
|
|
46290
|
+
commands: external_exports.array(external_exports.string().min(1).max(200)).min(1).max(100).optional(),
|
|
46291
|
+
instances: external_exports.array(external_exports.string().min(1).max(64)).min(1).max(20).optional()
|
|
46292
|
+
})).min(1).max(36)
|
|
46272
46293
|
});
|
|
46273
46294
|
meResponseSchema = external_exports.union([
|
|
46274
46295
|
external_exports.strictObject({
|
|
@@ -46282,14 +46303,16 @@ var init_api2 = __esm({
|
|
|
46282
46303
|
external_exports.strictObject({
|
|
46283
46304
|
username: external_exports.string(),
|
|
46284
46305
|
displayName: external_exports.string(),
|
|
46285
|
-
delegation: external_exports.strictObject({ label: external_exports.string(), expiresAt: external_exports.number().int(), scope: delegationScopeSchema.extend({ tools: external_exports.array(delegationScopeSchema.shape.tools.element.extend({ commands: external_exports.array(external_exports.string())
|
|
46306
|
+
delegation: external_exports.strictObject({ label: external_exports.string(), expiresAt: external_exports.number().int(), scope: delegationScopeSchema.extend({ tools: external_exports.array(delegationScopeSchema.shape.tools.element.extend({ commands: external_exports.array(external_exports.string()), instances: external_exports.array(instanceNameSchema).optional() })) }) }),
|
|
46286
46307
|
accessExpiresAt: external_exports.number().int(),
|
|
46287
46308
|
sessionExpiresAt: external_exports.number().int()
|
|
46288
46309
|
})
|
|
46289
46310
|
]);
|
|
46290
46311
|
createDelegationSchema = external_exports.strictObject({
|
|
46291
46312
|
label: external_exports.string().trim().min(1).max(100),
|
|
46292
|
-
scope: delegationScopeSchema
|
|
46313
|
+
scope: delegationScopeSchema.extend({ tools: external_exports.array(delegationScopeSchema.shape.tools.element.extend({
|
|
46314
|
+
instances: external_exports.array(instanceNameSchema).min(1).max(20).optional()
|
|
46315
|
+
})).min(1).max(36) }),
|
|
46293
46316
|
readOnly: external_exports.boolean(),
|
|
46294
46317
|
reusable: external_exports.boolean(),
|
|
46295
46318
|
expiresAt: external_exports.number().int().positive()
|
|
@@ -46466,6 +46489,7 @@ var init_api2 = __esm({
|
|
|
46466
46489
|
failed: external_exports.enum(["0", "1"]).optional(),
|
|
46467
46490
|
user: external_exports.string().min(1).max(256).optional(),
|
|
46468
46491
|
tool: toolSchema.optional(),
|
|
46492
|
+
instance: instanceNameSchema.optional(),
|
|
46469
46493
|
event: external_exports.string().min(1).max(100).optional(),
|
|
46470
46494
|
outcome: external_exports.string().min(1).max(100).optional(),
|
|
46471
46495
|
from: external_exports.iso.datetime().optional(),
|
|
@@ -46700,7 +46724,6 @@ var init_api2 = __esm({
|
|
|
46700
46724
|
normalizations: external_exports.array(external_exports.strictObject({ field: external_exports.string(), reason: external_exports.string() })).optional()
|
|
46701
46725
|
});
|
|
46702
46726
|
adminToolParamsSchema = external_exports.strictObject({ tool: toolSchema });
|
|
46703
|
-
instanceNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,31}$/);
|
|
46704
46727
|
adminInstanceParamsSchema = adminToolParamsSchema.extend({ name: instanceNameSchema });
|
|
46705
46728
|
adminInstanceSchema = external_exports.strictObject({
|
|
46706
46729
|
id: external_exports.string(),
|
|
@@ -47158,6 +47181,7 @@ var init_api2 = __esm({
|
|
|
47158
47181
|
id: accountId,
|
|
47159
47182
|
name: external_exports.string().min(1),
|
|
47160
47183
|
tools: external_exports.array(toolSchema),
|
|
47184
|
+
instanceGrants: external_exports.array(external_exports.strictObject({ tool: toolSchema, instances: external_exports.array(instanceNameSchema) })),
|
|
47161
47185
|
revision: external_exports.number().int().positive(),
|
|
47162
47186
|
updatedAt: external_exports.number().int().nullable(),
|
|
47163
47187
|
updatedBy: accountId.nullable()
|
|
@@ -47219,8 +47243,21 @@ var init_api2 = __esm({
|
|
|
47219
47243
|
response: adminRoleSchema,
|
|
47220
47244
|
authorization: "administrator-and-recent-auth",
|
|
47221
47245
|
auditEvent: "replace-role-tools"
|
|
47246
|
+
},
|
|
47247
|
+
instances: {
|
|
47248
|
+
method: "PUT",
|
|
47249
|
+
path: "/v1/admin/roles/:id/tools/:tool/instances",
|
|
47250
|
+
input: external_exports.strictObject({
|
|
47251
|
+
scope: external_exports.enum(["all", "selected"]),
|
|
47252
|
+
instances: external_exports.array(instanceNameSchema).refine((names) => new Set(names).size === names.length).default([]),
|
|
47253
|
+
expectedRevision: external_exports.number().int().positive()
|
|
47254
|
+
}).refine((input2) => input2.scope === "all" || input2.instances.length > 0),
|
|
47255
|
+
response: adminRoleSchema,
|
|
47256
|
+
authorization: "administrator-and-recent-auth",
|
|
47257
|
+
auditEvent: "replace-role-tool-instances"
|
|
47222
47258
|
}
|
|
47223
47259
|
};
|
|
47260
|
+
adminRoleToolParamsSchema = adminUserParamsSchema.extend({ tool: toolSchema });
|
|
47224
47261
|
toolsResponseSchema = external_exports.strictObject({
|
|
47225
47262
|
tools: external_exports.array(external_exports.strictObject({
|
|
47226
47263
|
name: toolSchema,
|
|
@@ -47228,7 +47265,14 @@ var init_api2 = __esm({
|
|
|
47228
47265
|
readOnly: external_exports.boolean().default(true),
|
|
47229
47266
|
status: external_exports.enum(["unconfigured", "unknown", "checking", "ok", "error", "disabled"]),
|
|
47230
47267
|
errorCode: healthSchema.shape.errorCode.optional(),
|
|
47231
|
-
commands: external_exports.array(external_exports.string()).optional()
|
|
47268
|
+
commands: external_exports.array(external_exports.string()).optional(),
|
|
47269
|
+
instances: external_exports.array(external_exports.strictObject({
|
|
47270
|
+
name: instanceNameSchema,
|
|
47271
|
+
description: external_exports.string(),
|
|
47272
|
+
status: external_exports.enum(["unknown", "checking", "ok", "error"]),
|
|
47273
|
+
readOnly: external_exports.boolean(),
|
|
47274
|
+
errorCode: healthSchema.shape.errorCode.optional()
|
|
47275
|
+
}))
|
|
47232
47276
|
}))
|
|
47233
47277
|
});
|
|
47234
47278
|
inputFileSchema = external_exports.strictObject({
|
|
@@ -100042,22 +100086,34 @@ function sessionExpiryView(expiresAt, now = Date.now()) {
|
|
|
100042
100086
|
}
|
|
100043
100087
|
function toolsView(tools) {
|
|
100044
100088
|
if (!tools.length) return "tools: 0 available\nreason: No enabled runtime tool is available through your assigned roles.\ncontact: Ask an administrator to check your role assignments and enabled tools.\nnext[1]:\n - artium-axi whoami\n";
|
|
100045
|
-
const example = tools[0].commands ? "" : ` - artium-axi ${tools[0].name} ${toolManifests[tools[0].name].discovery.example.join(" ")}
|
|
100089
|
+
const example = tools[0].commands || tools[0].instances.length > 1 ? "" : ` - artium-axi ${tools[0].name} ${toolManifests[tools[0].name].discovery.example.join(" ")}
|
|
100046
100090
|
`;
|
|
100047
|
-
return `tools[${tools.length}]{name,status,version,readOnly}:
|
|
100048
|
-
${tools.map((tool) => ` ${tool.name},${tool.status},${JSON.stringify(tool.version)},${tool.readOnly ?? true}`).join("\n")}
|
|
100091
|
+
return `tools[${tools.length}]{name,status,version,readOnly,instances}:
|
|
100092
|
+
${tools.map((tool) => ` ${tool.name},${tool.status},${JSON.stringify(tool.version)},${tool.readOnly ?? true},${tool.instances.length}`).join("\n")}
|
|
100049
100093
|
next[${example ? 2 : 1}]:
|
|
100050
100094
|
- artium-axi tools show ${tools[0].name}
|
|
100051
100095
|
${example}`;
|
|
100052
100096
|
}
|
|
100097
|
+
function instanceAdvice(tools) {
|
|
100098
|
+
const several = tools.filter((tool) => tool.instances.length > 1).map((tool) => tool.name);
|
|
100099
|
+
return several.length ? `${several.join(", ")} ${several.length > 1 ? "have" : "has"} several instances. Run artium-axi tools show <tool> for descriptions. When the user has not named an instance, ask which one to use, reading back the descriptions. Then run artium-axi --instance <name> <tool> ...` : void 0;
|
|
100100
|
+
}
|
|
100101
|
+
function instancesView(tool) {
|
|
100102
|
+
const instances = tool.instances;
|
|
100103
|
+
return `instances[${instances.length}]{name,status,readOnly,description}:
|
|
100104
|
+
${instances.map((instance) => ` ${instance.name},${instance.status},${instance.readOnly},${JSON.stringify(instance.description)}
|
|
100105
|
+
`).join("")}`;
|
|
100106
|
+
}
|
|
100053
100107
|
function toolView(tool) {
|
|
100054
100108
|
const manifest = toolManifests[tool.name];
|
|
100055
100109
|
if (tool.version !== manifest.version) throw new ArtiumError("INVALID_RESPONSE", "The server tool version differs from the bundled manifest.", "Download the current CLI from /cli/artium-axi.mjs.");
|
|
100110
|
+
const selector = tool.name === "ssh-axi" ? "" : "--instance <name> ";
|
|
100056
100111
|
if (tool.commands) return `tool: ${tool.name}
|
|
100057
100112
|
version: ${JSON.stringify(tool.version)}
|
|
100058
100113
|
status: ${tool.status}
|
|
100059
100114
|
readOnly: ${tool.readOnly ?? true}
|
|
100060
|
-
commands[${tool.commands.length}]: ${tool.commands.map((command) => JSON.stringify(command)).join(",")}
|
|
100115
|
+
${instancesView(tool)}commands[${tool.commands.length}]: ${tool.commands.map((command) => JSON.stringify(command)).join(",")}
|
|
100116
|
+
example: artium-axi ${selector}${tool.name} ...
|
|
100061
100117
|
`;
|
|
100062
100118
|
const commands3 = manifest.discovery.commands;
|
|
100063
100119
|
const help2 = rewriteDiscoveryHelp(manifest.discovery.help, tool.name);
|
|
@@ -100065,8 +100121,8 @@ commands[${tool.commands.length}]: ${tool.commands.map((command) => JSON.stringi
|
|
|
100065
100121
|
version: ${JSON.stringify(tool.version)}
|
|
100066
100122
|
status: ${tool.status}
|
|
100067
100123
|
readOnly: ${tool.readOnly ?? true}
|
|
100068
|
-
commands[${commands3.length}]: ${commands3.join(",")}
|
|
100069
|
-
example: artium-axi ${tool.name} ${manifest.discovery.example.join(" ")}
|
|
100124
|
+
${instancesView(tool)}commands[${commands3.length}]: ${commands3.join(",")}
|
|
100125
|
+
example: artium-axi ${selector}${tool.name} ${manifest.discovery.example.join(" ")}
|
|
100070
100126
|
upstreamHelp: ${JSON.stringify(help2)}
|
|
100071
100127
|
`;
|
|
100072
100128
|
}
|
|
@@ -100207,7 +100263,7 @@ ${protocol.map((line) => ` - ${JSON.stringify(line)}`).join("\n")}
|
|
|
100207
100263
|
function validateArguments(args2, prefixHelp) {
|
|
100208
100264
|
const command = args2[0];
|
|
100209
100265
|
if (command === "tools") args2 = [...args2.filter((arg) => arg !== "--help"), ...args2.filter((arg) => arg === "--help")];
|
|
100210
|
-
const rootFlags = "--help, --version, -v, -V, --managed-session (before the command)";
|
|
100266
|
+
const rootFlags = "--help, --version, -v, -V, --managed-session (before the command), --instance <name> (before the tool name)";
|
|
100211
100267
|
const rootCommands = Object.keys(commands).filter((name) => name !== "home" && name !== "managed-session" && name !== "tools show").join(", ");
|
|
100212
100268
|
function fail(token, level2, choices2) {
|
|
100213
100269
|
const kind = token?.startsWith("-") ? "flag" : "argument";
|
|
@@ -100331,7 +100387,15 @@ var init_help = __esm({
|
|
|
100331
100387
|
flags: ["Repository commands require -R OWNER/NAME. Writes require an administrator-enabled exact operation: preview, then repeat with its --confirm value. api is GET only; deletes, secret set, merge --admin, local git, files and downloads are unavailable. Only gist create/edit with --filename accepts piped stdin."],
|
|
100332
100388
|
example: "artium-axi gh-axi repo list --limit 1"
|
|
100333
100389
|
},
|
|
100334
|
-
home: {
|
|
100390
|
+
home: {
|
|
100391
|
+
usage: "artium-axi [tools [show <tool>]|whoami|login|token|passwd|logout|doctor|setup|update|download|[--instance <name>] <tool> <args>]",
|
|
100392
|
+
purpose: "Show your identity, roles and available tools.",
|
|
100393
|
+
flags: [
|
|
100394
|
+
"--version, -v, -V (default false; print the client package version and exit)",
|
|
100395
|
+
"--instance <name> (before the tool name; selects one named instance for that run; refused for ssh-axi, Proxmox result, Kubernetes tunnel, credential and workspace or session commands other than workspace create and session start, and Shodan radar; accepted by Shodan stream session preview and start and scan submit)"
|
|
100396
|
+
],
|
|
100397
|
+
example: "artium-axi"
|
|
100398
|
+
},
|
|
100335
100399
|
setup: {
|
|
100336
100400
|
usage: "artium-axi setup --host <claude|codex|opencode|pi> [--hook] [--force]",
|
|
100337
100401
|
purpose: "Install skills for your signed-in account\u2019s granted tools and optional ambient context for Claude Code, Codex or OpenCode.",
|
|
@@ -101428,7 +101492,9 @@ var init_proxmox_stream = __esm({
|
|
|
101428
101492
|
"use strict";
|
|
101429
101493
|
init_zod();
|
|
101430
101494
|
init_websocket();
|
|
101495
|
+
init_api2();
|
|
101431
101496
|
proxmoxStreamStart = external_exports.strictObject({
|
|
101497
|
+
instance: instanceNameSchema.optional(),
|
|
101432
101498
|
args: external_exports.array(external_exports.string().max(8192)).min(3).max(64).refine((args2) => args2.reduce((size, arg) => size + Buffer.byteLength(arg), 0) <= 65536),
|
|
101433
101499
|
stdin: external_exports.string().max(65536).optional(),
|
|
101434
101500
|
source: external_exports.strictObject({ bytes: external_exports.number().int().min(0), sha256: external_exports.string().regex(/^[a-f0-9]{64}$/) }).optional()
|
|
@@ -101553,7 +101619,7 @@ async function openProxmoxStream(client, id, token, signal) {
|
|
|
101553
101619
|
request.end();
|
|
101554
101620
|
});
|
|
101555
101621
|
}
|
|
101556
|
-
async function proxmoxStream(createClient, supplied, output3) {
|
|
101622
|
+
async function proxmoxStream(createClient, supplied, output3, instance) {
|
|
101557
101623
|
if (supplied[0] !== "stream") return false;
|
|
101558
101624
|
const usage = "artium-axi proxmox-axi stream -- transfer|duplex <native arguments>";
|
|
101559
101625
|
const { separator, json: json2, options, args: args2, route } = resolveProxmoxStream(supplied);
|
|
@@ -101623,6 +101689,7 @@ async function proxmoxStream(createClient, supplied, output3) {
|
|
|
101623
101689
|
}
|
|
101624
101690
|
const response = leaseSchema.safeParse(await client.authenticated("/v1/tools/proxmox-axi/streams", "POST", {
|
|
101625
101691
|
args: input2.args,
|
|
101692
|
+
...instance === void 0 ? {} : { instance },
|
|
101626
101693
|
...input2.stdin === void 0 ? {} : { stdin: input2.stdin },
|
|
101627
101694
|
...sourceInfo ? { source: sourceInfo } : {}
|
|
101628
101695
|
}));
|
|
@@ -101796,7 +101863,7 @@ var init_proxmox_stream2 = __esm({
|
|
|
101796
101863
|
});
|
|
101797
101864
|
|
|
101798
101865
|
// src/cli/shodan-session.ts
|
|
101799
|
-
async function shodanSession(args2, createClient, output3) {
|
|
101866
|
+
async function shodanSession(args2, createClient, output3, instance) {
|
|
101800
101867
|
if (args2[0] !== "stream" || args2[1] !== "session") return false;
|
|
101801
101868
|
if (args2.includes("--help")) {
|
|
101802
101869
|
output3("stdout", help);
|
|
@@ -101841,6 +101908,7 @@ async function shodanSession(args2, createClient, output3) {
|
|
|
101841
101908
|
stop: []
|
|
101842
101909
|
};
|
|
101843
101910
|
if (!action || !permitted[action] || [...values.keys()].some((key) => !permitted[action].includes(key)) || switches.has("--accept-unknown-cost") && !["preview", "start"].includes(action) || switches.has("--wait") && action !== "read") throw new ArtiumError("INVALID_INPUT");
|
|
101911
|
+
if (instance !== void 0 && !["preview", "start"].includes(action)) throw new ArtiumError("INVALID_INPUT", "--instance applies only to stream session preview and start.", "Run the command without --instance.");
|
|
101844
101912
|
const number4 = (name) => {
|
|
101845
101913
|
const value = values.get(name);
|
|
101846
101914
|
if (value === void 0) return void 0;
|
|
@@ -101866,7 +101934,7 @@ async function shodanSession(args2, createClient, output3) {
|
|
|
101866
101934
|
}, acceptUnknownCost: true });
|
|
101867
101935
|
if (!parsed.success || action === "start" && !external_exports.uuid().safeParse(values.get("--confirm")).success) throw new ArtiumError("INVALID_INPUT");
|
|
101868
101936
|
path += `/${action}`;
|
|
101869
|
-
body = { ...parsed.data, ...action === "start" ? { confirm: values.get("--confirm") } : {} };
|
|
101937
|
+
body = { ...parsed.data, ...action === "start" ? { confirm: values.get("--confirm") } : {}, ...instance === void 0 ? {} : { instance } };
|
|
101870
101938
|
} else {
|
|
101871
101939
|
if (positional.length !== 1 || !external_exports.uuid().safeParse(positional[0]).success) throw new ArtiumError("INVALID_INPUT");
|
|
101872
101940
|
path += `/${positional[0]}`;
|
|
@@ -102184,7 +102252,7 @@ var init_shodan_radar = __esm({
|
|
|
102184
102252
|
});
|
|
102185
102253
|
|
|
102186
102254
|
// src/cli/shodan-scan.ts
|
|
102187
|
-
async function shodanScan(args2, createClient, output3) {
|
|
102255
|
+
async function shodanScan(args2, createClient, output3, instance) {
|
|
102188
102256
|
if (args2[0] !== "scan" || args2[1] !== "submit") return false;
|
|
102189
102257
|
if (args2.includes("--help")) {
|
|
102190
102258
|
output3("stdout", "usage: artium-axi shodan-axi scan submit <targets> [options]\nUse exact --allow-operation grants, --scan-credit-budget and --max-requests. Collection also needs --wait, --limit, --max-bytes, --idle-timeout, --accept-unknown-cost and the OP-046 stream grant. Preview first, then repeat with --execute --confirm <token>.\n");
|
|
@@ -102237,7 +102305,7 @@ async function shodanScan(args2, createClient, output3) {
|
|
|
102237
102305
|
if (!parsed.success) throw new ArtiumError("INVALID_INPUT");
|
|
102238
102306
|
const client = createClient();
|
|
102239
102307
|
await client.authenticated("/v1/me", "GET");
|
|
102240
|
-
const call = (path, body) => client.transferSession((token) => client.request(path, "POST", body, token));
|
|
102308
|
+
const call = (path, body) => client.transferSession((token) => client.request(path, "POST", instance === void 0 ? body : { ...body, instance }, token));
|
|
102241
102309
|
if (!switches.has("--execute")) {
|
|
102242
102310
|
const result2 = await call(prefix + "/preview", parsed.data);
|
|
102243
102311
|
output3("stdout", (switches.has("--json") ? JSON.stringify(result2) : encode(result2)) + "\n");
|
|
@@ -102803,11 +102871,13 @@ async function sessionContext() {
|
|
|
102803
102871
|
const parsed = toolsResponseSchema.safeParse(await client.authenticated("/v1/tools", "GET", void 0, previous));
|
|
102804
102872
|
if (!parsed.success) throw new ArtiumError("INVALID_RESPONSE");
|
|
102805
102873
|
const tools = [...new Map(parsed.data.tools.map((tool) => [tool.name, tool])).values()];
|
|
102874
|
+
const advice = instanceAdvice(tools);
|
|
102875
|
+
const note = advice ? JSON.stringify(`Server roles and write gates still apply. ${advice}`) : "Server roles and write gates still apply.";
|
|
102806
102876
|
return `artium: available
|
|
102807
|
-
tools[${tools.length}]{name,status,readOnly}:
|
|
102808
|
-
${tools.map((tool) => ` ${tool.name},${tool.status},${tool.readOnly ?? true}`).join("\n")}
|
|
102877
|
+
tools[${tools.length}]{name,status,readOnly,instances}:
|
|
102878
|
+
${tools.map((tool) => ` ${tool.name},${tool.status},${tool.readOnly ?? true},${tool.instances.length}`).join("\n")}
|
|
102809
102879
|
next: artium-axi tools
|
|
102810
|
-
note:
|
|
102880
|
+
note: ${note}
|
|
102811
102881
|
`;
|
|
102812
102882
|
} catch (error62) {
|
|
102813
102883
|
const code = error62 instanceof ArtiumError ? error62.code : "INTERNAL_ERROR";
|
|
@@ -102828,6 +102898,7 @@ var init_session_context = __esm({
|
|
|
102828
102898
|
init_api2();
|
|
102829
102899
|
init_errors3();
|
|
102830
102900
|
init_http();
|
|
102901
|
+
init_views();
|
|
102831
102902
|
}
|
|
102832
102903
|
});
|
|
102833
102904
|
|
|
@@ -103500,7 +103571,7 @@ async function fileBytes(path, limit = 100 * 1024 * 1024) {
|
|
|
103500
103571
|
await file2.close();
|
|
103501
103572
|
}
|
|
103502
103573
|
}
|
|
103503
|
-
async function kubernetesHosted(args2, createClient, write, permittedCommands) {
|
|
103574
|
+
async function kubernetesHosted(args2, createClient, write, permittedCommands, instance) {
|
|
103504
103575
|
let prefix2 = 0;
|
|
103505
103576
|
while (args2[prefix2] === "--json") prefix2++;
|
|
103506
103577
|
if (args2[prefix2] === "tunnel") return kubernetesTunnel(createClient, [...args2.slice(prefix2), ...prefix2 ? ["--json"] : []], (text2) => write(text2));
|
|
@@ -103529,6 +103600,7 @@ async function kubernetesHosted(args2, createClient, write, permittedCommands) {
|
|
|
103529
103600
|
return false;
|
|
103530
103601
|
}
|
|
103531
103602
|
const { flags, positionals, native, help: help2, route } = kubernetesHostedArguments(rest, group, action);
|
|
103603
|
+
if (instance !== void 0 && !help2 && !["workspace create", "session start"].includes(route)) throw new ArtiumError("INVALID_INPUT");
|
|
103532
103604
|
const print = (value) => write((prefix2 || flags.has("--json") ? JSON.stringify(value) : encode(value)) + "\n");
|
|
103533
103605
|
if (help2) {
|
|
103534
103606
|
const kinds = (permittedCommands ?? []).filter((command) => command.startsWith("session start ")).map((command) => command.slice("session start ".length));
|
|
@@ -103577,7 +103649,7 @@ async function kubernetesHosted(args2, createClient, write, permittedCommands) {
|
|
|
103577
103649
|
}
|
|
103578
103650
|
};
|
|
103579
103651
|
await visit2(root);
|
|
103580
|
-
const manifest = validated(kubernetesWorkspaceManifest, { files });
|
|
103652
|
+
const manifest = validated(kubernetesWorkspaceManifest, { files, instance });
|
|
103581
103653
|
const workspace = validated(workspaceSchema, await call(base2, "POST", manifest), "INVALID_RESPONSE");
|
|
103582
103654
|
try {
|
|
103583
103655
|
for (const file2 of files) await call(`${base2}/${workspace.id}/files/${file2.path.split("/").map(encodeURIComponent).join("/")}`, "PUT", await fileBytes(join5(root, file2.path)));
|
|
@@ -103602,6 +103674,7 @@ async function kubernetesHosted(args2, createClient, write, permittedCommands) {
|
|
|
103602
103674
|
const kind = positionals[0];
|
|
103603
103675
|
const input2 = validated(kubernetesSessionStart, {
|
|
103604
103676
|
kind,
|
|
103677
|
+
instance,
|
|
103605
103678
|
argv: ["watch", "logs"].includes(kind) ? native : ["prepare", "--", ...native],
|
|
103606
103679
|
workspace: flags.get("--workspace"),
|
|
103607
103680
|
...flags.has("--stdin-file") ? { stdinBase64: (await fileBytes(flags.get("--stdin-file"), 512 * 1024)).toString("base64") } : {},
|
|
@@ -103691,7 +103764,7 @@ import { setTimeout as delay2 } from "node:timers/promises";
|
|
|
103691
103764
|
async function tokenCommand(args2, output3, managed2) {
|
|
103692
103765
|
const action = args2[0];
|
|
103693
103766
|
if (args2.includes("--help")) {
|
|
103694
|
-
output3("usage: artium-axi token create --label <label> --tool <tool> --expires <ISO-date> [--write] [--reusable] [--command <tool:command>] [--exact <tool:command>] [--token-fd <fd>] [--password-stdin|--sso]\n artium-axi token list\n artium-axi token revoke <id>\nCommand picks are exact. Wildcards are not supported yet. API and native selections are broad and require an exact pick.\nRead-only blocks writes, but some reads send data externally or incur costs.\nSSH write access reaches every host and sudo grant available to the creator.\n");
|
|
103767
|
+
output3("usage: artium-axi token create --label <label> --tool <tool> --expires <ISO-date> [--write] [--reusable] [--command <tool:command>] [--exact <tool:command>] [--instance <tool:name>] [--token-fd <fd>] [--password-stdin|--sso]\n artium-axi token list\n artium-axi token revoke <id>\nCommand picks are exact. Wildcards are not supported yet.\n--instance limits every selection for a tool to the named instances; without it a tool selection covers every instance you can use. API and native selections are broad and require an exact pick.\nRead-only blocks writes, but some reads send data externally or incur costs.\nSSH write access reaches every host and sudo grant available to the creator.\n");
|
|
103695
103768
|
return;
|
|
103696
103769
|
}
|
|
103697
103770
|
if (managed2) throw new ArtiumError("INVALID_INPUT", "Token management is unavailable in managed mode.");
|
|
@@ -103710,7 +103783,7 @@ async function tokenCommand(args2, output3, managed2) {
|
|
|
103710
103783
|
action === "list" ? "Use artium-axi token list; valid flags: --help." : "Use artium-axi token revoke <id>; valid flags: --help."
|
|
103711
103784
|
);
|
|
103712
103785
|
if (action !== "create") throw new ArtiumError("INVALID_INPUT", "Invalid token command.", "Use artium-axi token --help.");
|
|
103713
|
-
const createFlags = ["--label", "--tool", "--expires", "--write", "--reusable", "--command", "--exact", "--token-fd", "--password-stdin", "--sso"];
|
|
103786
|
+
const createFlags = ["--label", "--tool", "--expires", "--write", "--reusable", "--command", "--exact", "--instance", "--token-fd", "--password-stdin", "--sso"];
|
|
103714
103787
|
const flags = /* @__PURE__ */ new Map();
|
|
103715
103788
|
for (let index = 1; index < args2.length; index++) {
|
|
103716
103789
|
const flag = args2[index];
|
|
@@ -103720,7 +103793,7 @@ async function tokenCommand(args2, output3, managed2) {
|
|
|
103720
103793
|
`Valid flags: --help, ${createFlags.join(", ")}.`
|
|
103721
103794
|
);
|
|
103722
103795
|
const values = flags.get(flag) ?? [];
|
|
103723
|
-
if (values.length && !["--tool", "--command", "--exact"].includes(flag)) throw new ArtiumError("INVALID_INPUT");
|
|
103796
|
+
if (values.length && !["--tool", "--command", "--exact", "--instance"].includes(flag)) throw new ArtiumError("INVALID_INPUT");
|
|
103724
103797
|
const value = ["--write", "--reusable", "--password-stdin", "--sso"].includes(flag) ? "true" : args2[++index];
|
|
103725
103798
|
if (!value || value.startsWith("--")) throw new ArtiumError("INVALID_INPUT");
|
|
103726
103799
|
if (["--exact", "--command"].includes(flag) && value.includes("*")) throw new ArtiumError(
|
|
@@ -103745,7 +103818,17 @@ async function tokenCommand(args2, output3, managed2) {
|
|
|
103745
103818
|
if (separator < 0) throw new ArtiumError("INVALID_INPUT");
|
|
103746
103819
|
return { tool: readTool(value.slice(0, separator)), commands: [value.slice(separator + 1)] };
|
|
103747
103820
|
});
|
|
103748
|
-
|
|
103821
|
+
const instances = /* @__PURE__ */ new Map();
|
|
103822
|
+
for (const value of flags.get("--instance") ?? []) {
|
|
103823
|
+
const separator = value.indexOf(":");
|
|
103824
|
+
if (separator < 0) throw new ArtiumError("INVALID_INPUT", "Invalid --instance value.", "Use --instance <tool>:<name>.");
|
|
103825
|
+
const tool = readTool(value.slice(0, separator));
|
|
103826
|
+
instances.set(tool, [...instances.get(tool) ?? [], value.slice(separator + 1)]);
|
|
103827
|
+
}
|
|
103828
|
+
const selections = [...tools, ...picks].map((item) => ({ ...item, ...instances.has(item.tool) ? { instances: instances.get(item.tool) } : {} }));
|
|
103829
|
+
if (!label || !Number.isFinite(expiresAt) || !selections.length || [...instances.keys()].some((tool) => !selections.some((item) => item.tool === tool))) {
|
|
103830
|
+
throw new ArtiumError("INVALID_INPUT");
|
|
103831
|
+
}
|
|
103749
103832
|
const fdText = flags.get("--token-fd")?.[0];
|
|
103750
103833
|
if (!fdText && !process.stdout.isTTY) throw new ArtiumError("INVALID_INPUT", "A private token destination is required.", "Use --token-fd with an inherited pipe or socket.");
|
|
103751
103834
|
const fd = fdText === void 0 ? 1 : Number(fdText);
|
|
@@ -103789,7 +103872,7 @@ code: ${start.userCode}
|
|
|
103789
103872
|
const { ticket } = reauthResponseSchema.parse(proof);
|
|
103790
103873
|
const response = createdDelegationSchema.parse(await client.request("/v1/account/tokens", "POST", {
|
|
103791
103874
|
label,
|
|
103792
|
-
scope: { tools:
|
|
103875
|
+
scope: { tools: selections },
|
|
103793
103876
|
readOnly: !flags.has("--write"),
|
|
103794
103877
|
reusable: flags.has("--reusable"),
|
|
103795
103878
|
expiresAt
|
|
@@ -103821,7 +103904,31 @@ function output2(stream, text2) {
|
|
|
103821
103904
|
if (managed) managed.write(stream, text2);
|
|
103822
103905
|
else process[stream].write(text2);
|
|
103823
103906
|
}
|
|
103907
|
+
function instanceErrorAdvice(error62, instance) {
|
|
103908
|
+
if (instance === void 0 || !(error62 instanceof ArtiumError) || error62.code !== "INVALID_INPUT") return error62;
|
|
103909
|
+
return Object.assign(error62, { next: `${error62.next} If the server does not support --instance, upgrade it to a version that supports named tool instances.` });
|
|
103910
|
+
}
|
|
103911
|
+
async function resolveDiscoveryInstance(client, tool, instance) {
|
|
103912
|
+
const response = await client.authenticated(`/v1/tools/${tool}/run`, "POST", { args: ["--help"], instance }).catch((error62) => {
|
|
103913
|
+
throw instanceErrorAdvice(error62, instance);
|
|
103914
|
+
});
|
|
103915
|
+
const parsed = runSuccessSchema.safeParse(response);
|
|
103916
|
+
if (!parsed.success || parsed.data.source !== tool) throw new ArtiumError("INVALID_RESPONSE");
|
|
103917
|
+
if (parsed.data.exitCode === 0) return true;
|
|
103918
|
+
output2("stdout", parsed.data.stdout);
|
|
103919
|
+
output2("stderr", parsed.data.stderr);
|
|
103920
|
+
process.exitCode = parsed.data.exitCode;
|
|
103921
|
+
return false;
|
|
103922
|
+
}
|
|
103824
103923
|
async function main(args2) {
|
|
103924
|
+
const instanceAt = args2[0] === "--managed-session" ? 1 : 0;
|
|
103925
|
+
let instance;
|
|
103926
|
+
if (args2[instanceAt] === "--instance") {
|
|
103927
|
+
const parsed = instanceNameSchema.safeParse(args2[instanceAt + 1]);
|
|
103928
|
+
if (!parsed.success) throw new ArtiumError("INVALID_INPUT", "Expected --instance <name> before the tool name.", "Use artium-axi --instance <name> <tool> <args>.");
|
|
103929
|
+
instance = parsed.data;
|
|
103930
|
+
args2 = [...args2.slice(0, instanceAt), ...args2.slice(instanceAt + 2)];
|
|
103931
|
+
}
|
|
103825
103932
|
if (args2.length === 2 && args2.includes("--managed-session") && args2.includes("--help")) {
|
|
103826
103933
|
output2("stdout", commandHelp("managed-session"));
|
|
103827
103934
|
return;
|
|
@@ -103830,6 +103937,10 @@ async function main(args2) {
|
|
|
103830
103937
|
validateArguments(localArgs[0] === "--help" ? localArgs.slice(1) : localArgs, localArgs[0] === "--help");
|
|
103831
103938
|
const managedMode = args2[0] === "--managed-session";
|
|
103832
103939
|
if (managedMode) args2 = args2.slice(1);
|
|
103940
|
+
const kubernetesGroup = args2.slice(1).find((arg) => arg !== "--json");
|
|
103941
|
+
if (instance !== void 0 && (!toolSchema.safeParse(args2[0]).success || args2[0] === "ssh-axi" || args2[0] === "proxmox-axi" && args2[1] === "result" || args2[0] === "kubernetes-axi" && ["tunnel", "credential"].includes(kubernetesGroup ?? "") || args2[0] === "shodan-axi" && args2[1] === "radar")) {
|
|
103942
|
+
throw new ArtiumError("INVALID_INPUT", "--instance applies only to tool runs that support named instances.", "Run the command without --instance.");
|
|
103943
|
+
}
|
|
103833
103944
|
if (args2.length === 1 && ["--version", "-v", "-V"].includes(args2[0])) {
|
|
103834
103945
|
output2("stdout", `${cliVersion}
|
|
103835
103946
|
`);
|
|
@@ -103878,6 +103989,9 @@ async function main(args2) {
|
|
|
103878
103989
|
const { tools } = toolsResponseSchema.parse(await client2.authenticated("/v1/tools", "GET"));
|
|
103879
103990
|
if (tools.some((tool) => tool.commands === void 0)) throw new ArtiumError("INVALID_RESPONSE");
|
|
103880
103991
|
const downloadOperation = toolDiscovery ? transferSelectionSchema.options.map((option) => option.shape.operation.value).find((operation) => transferTool(operation) === command && operation === (toolWords[0] === "help" ? toolWords.slice(1) : toolWords).join(" ")) : void 0;
|
|
103992
|
+
if (instance !== void 0 && toolDiscovery && (downloadOperation || toolWords.length === 0 || toolWords.length === 1 && ["commands", "home", "help"].includes(toolWords[0]))) {
|
|
103993
|
+
if (!await resolveDiscoveryInstance(client2, command, instance)) return;
|
|
103994
|
+
}
|
|
103881
103995
|
if (help2 === "download" || downloadOperation) {
|
|
103882
103996
|
const operations = transferSelectionSchema.options.map((option) => option.shape.operation.value).filter((operation) => tools.some((tool) => tool.name === transferTool(operation) && tool.commands?.includes(operation)));
|
|
103883
103997
|
if (downloadOperation && !operations.includes(downloadOperation)) throw new ArtiumError("DELEGATED_SCOPE_DENIED");
|
|
@@ -103903,16 +104017,19 @@ async function main(args2) {
|
|
|
103903
104017
|
return;
|
|
103904
104018
|
}
|
|
103905
104019
|
if (!stream.route || !tool.commands?.includes(stream.route.command)) throw new ArtiumError("DELEGATED_SCOPE_DENIED");
|
|
103906
|
-
await proxmoxStream(() => client2, hostedArgs, output2);
|
|
104020
|
+
await proxmoxStream(() => client2, hostedArgs, output2, instance);
|
|
103907
104021
|
return;
|
|
103908
104022
|
}
|
|
103909
104023
|
const hosted = name === "kubernetes-axi" ? resolveKubernetesHostedCommand(hostedArgs) : void 0;
|
|
103910
104024
|
if (hosted && kubernetesHostedRoutes.some((route) => route.command === hosted)) {
|
|
103911
104025
|
if (!tool?.commands?.includes(hosted)) throw new ArtiumError("DELEGATED_SCOPE_DENIED");
|
|
103912
|
-
await kubernetesHosted(hostedArgs, () => client2, (text2, stream = "stdout") => output2(stream, text2), tool.commands);
|
|
104026
|
+
await kubernetesHosted(hostedArgs, () => client2, (text2, stream = "stdout") => output2(stream, text2), tool.commands, instance);
|
|
103913
104027
|
return;
|
|
103914
104028
|
}
|
|
103915
|
-
const
|
|
104029
|
+
const response = await client2.authenticated(`/v1/tools/${name}/run`, "POST", { args: args2.slice(1), ...instance === void 0 ? {} : { instance } }).catch((error62) => {
|
|
104030
|
+
throw instanceErrorAdvice(error62, instance);
|
|
104031
|
+
});
|
|
104032
|
+
const parsed = runSuccessSchema.safeParse(response);
|
|
103916
104033
|
if (!parsed.success || parsed.data.source !== name) throw new ArtiumError("INVALID_RESPONSE");
|
|
103917
104034
|
const { truncated } = parsed.data;
|
|
103918
104035
|
if (truncated.stdout || truncated.stderr) output2("stderr", `artium-axi: output truncated (${["stdout", "stderr"].filter((stream) => truncated[stream]).join(", ")}).
|
|
@@ -104088,13 +104205,18 @@ remoteRevocation: ${verified ? "verified" : "unverified"}
|
|
|
104088
104205
|
throw new ArtiumError("INVALID_INPUT", "Unknown command, argument or flag.", "Use artium-axi --help for commands or artium-axi <command> --help for valid flags.");
|
|
104089
104206
|
}
|
|
104090
104207
|
if (command === "ssh-axi" && await sshExecution(args2.slice(1), () => new Client(process.env, managed), (text2) => output2("stdout", text2))) return;
|
|
104091
|
-
if (command === "kubernetes-axi" &&
|
|
104208
|
+
if (command === "kubernetes-axi" && instance !== void 0 && args2.slice(1).includes("--help") && args2.slice(1).every((arg) => ["--help", "--json"].includes(arg)) && !await resolveDiscoveryInstance(new Client(process.env, managed), command, instance)) return;
|
|
104209
|
+
if (command === "kubernetes-axi" && await kubernetesHosted(args2.slice(1), () => new Client(process.env, managed), (text2, stream = "stdout") => output2(stream, text2), void 0, instance)) return;
|
|
104092
104210
|
if (command === "proxmox-axi" && await proxmoxPrivateResult(() => new Client(process.env, managed), args2.slice(1), (text2) => output2("stdout", text2))) return;
|
|
104093
|
-
if (command === "proxmox-axi" && await proxmoxStream(() => new Client(process.env, managed), args2.slice(1), output2)) return;
|
|
104094
|
-
if (command === "shodan-axi" && await shodanSession(args2.slice(1), () => new Client(process.env, managed), output2))
|
|
104211
|
+
if (command === "proxmox-axi" && await proxmoxStream(() => new Client(process.env, managed), args2.slice(1), output2, instance)) return;
|
|
104212
|
+
if (command === "shodan-axi" && await shodanSession(args2.slice(1), () => new Client(process.env, managed), output2, instance).catch((error62) => {
|
|
104213
|
+
throw instanceErrorAdvice(error62, instance);
|
|
104214
|
+
})) return;
|
|
104095
104215
|
if (command === "shodan-axi" && await shodanRadar(args2.slice(1), () => new Client(process.env, managed), output2)) return;
|
|
104096
|
-
if (command === "shodan-axi" && await shodanScan(args2.slice(1), () => new Client(process.env, managed), output2))
|
|
104097
|
-
|
|
104216
|
+
if (command === "shodan-axi" && await shodanScan(args2.slice(1), () => new Client(process.env, managed), output2, instance).catch((error62) => {
|
|
104217
|
+
throw instanceErrorAdvice(error62, instance);
|
|
104218
|
+
})) return;
|
|
104219
|
+
const input2 = home || listing || whoami ? void 0 : { ...await toolInput(command, args2.slice(1)), ...instance === void 0 ? {} : { instance } };
|
|
104098
104220
|
const client = new Client(process.env, managed);
|
|
104099
104221
|
const homeSession = home && !managed ? client.sessions.read() : void 0;
|
|
104100
104222
|
if (home && !managed && !homeSession) throw new ArtiumError("TOKEN_INVALID", void 0, "Run artium-axi login --username <username> --password-stdin.");
|
|
@@ -104102,7 +104224,7 @@ remoteRevocation: ${verified ? "verified" : "unverified"}
|
|
|
104102
104224
|
client.authenticated(home || whoami ? "/v1/me" : `/v1/tools${listing ? "" : `/${command}/run`}`, home || listing || whoami ? "GET" : "POST", input2, homeSession),
|
|
104103
104225
|
home ? client.authenticated("/v1/tools", "GET", void 0, homeSession) : void 0
|
|
104104
104226
|
])).map((response) => {
|
|
104105
|
-
if (response.status === "rejected") throw response.reason;
|
|
104227
|
+
if (response.status === "rejected") throw instanceErrorAdvice(response.reason, instance);
|
|
104106
104228
|
return response.value;
|
|
104107
104229
|
});
|
|
104108
104230
|
if (home || whoami) {
|