@knowttl/artium-axi 0.0.36 → 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 +253 -45
- 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",
|
|
@@ -21989,7 +21989,11 @@ var init_errors3 = __esm({
|
|
|
21989
21989
|
TOKEN_EXPIRED: { status: 401, message: "The token has expired.", next: "Sign in again." },
|
|
21990
21990
|
USER_DISABLED: { status: 403, message: "The user is disabled.", next: "Ask the administrator to enable the user." },
|
|
21991
21991
|
TOOL_DISABLED: { status: 403, message: "The tool is disabled.", next: "Ask the administrator to enable the tool." },
|
|
21992
|
+
INSTANCE_REQUIRED: { status: 409, message: "The tool has several usable instances and the request named none.", next: "Name the instance to use." },
|
|
21993
|
+
INSTANCE_NOT_FOUND: { status: 404, message: "The tool has no instance with that name.", next: "Name an existing instance of the tool." },
|
|
21994
|
+
INSTANCE_DISABLED: { status: 403, message: "The instance is disabled.", next: "Name another instance, or ask the administrator to enable it." },
|
|
21992
21995
|
TOOL_NOT_GRANTED: { status: 403, message: "The user has no role granting this tool.", next: "Ask the administrator to assign a role granting the tool." },
|
|
21996
|
+
RAW_API_DENIED: { status: 403, message: "Raw API access is not permitted for this tool, method or role.", next: "Use a named command, or ask the administrator to enable Raw API for the tool and grant it to a role." },
|
|
21993
21997
|
MASTER_KEY_INVALID: { status: 503, message: "The master key is missing or invalid.", next: "Supply a 32-byte master key file or a base64 master key." },
|
|
21994
21998
|
CREDENTIAL_INVALID: { status: 503, message: "The stored credential is invalid.", next: "Ask an administrator to check the named field, matching master key and credential JSON, then save and test again." },
|
|
21995
21999
|
CREDENTIAL_EXPIRED: { status: 503, message: "The GitHub credential expired or was revoked.", next: "Ask an administrator to reconnect at /admin/tools/gh-axi. Tokens are never refreshed automatically." },
|
|
@@ -22035,6 +22039,16 @@ var init_errors3 = __esm({
|
|
|
22035
22039
|
}
|
|
22036
22040
|
});
|
|
22037
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
|
+
|
|
22038
22052
|
// src/shared/kubernetes.ts
|
|
22039
22053
|
function resolveKubernetesHostedCommand(args2) {
|
|
22040
22054
|
let prefix2 = 0;
|
|
@@ -22092,6 +22106,7 @@ var init_kubernetes = __esm({
|
|
|
22092
22106
|
"use strict";
|
|
22093
22107
|
init_zod();
|
|
22094
22108
|
init_errors3();
|
|
22109
|
+
init_instance();
|
|
22095
22110
|
kubernetesHostedCommands = [
|
|
22096
22111
|
"workspace create <directory>",
|
|
22097
22112
|
"workspace show <id>",
|
|
@@ -22135,12 +22150,14 @@ var init_kubernetes = __esm({
|
|
|
22135
22150
|
}).passthrough();
|
|
22136
22151
|
kubernetesWorkspaceManifest = external_exports.strictObject({
|
|
22137
22152
|
files: external_exports.array(kubernetesFile).min(1).max(100),
|
|
22138
|
-
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()
|
|
22139
22155
|
});
|
|
22140
22156
|
kubernetesSessionStart = external_exports.strictObject({
|
|
22141
22157
|
kind: kubernetesSessionKind,
|
|
22142
22158
|
argv: external_exports.array(external_exports.string().max(8192)).min(1).max(256),
|
|
22143
22159
|
workspace: external_exports.uuid().optional(),
|
|
22160
|
+
instance: instanceNameSchema.optional(),
|
|
22144
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(),
|
|
22145
22162
|
inputArtifact: external_exports.strictObject({ workspace: external_exports.uuid(), path: kubernetesWorkspacePath }).optional(),
|
|
22146
22163
|
limits: external_exports.strictObject({
|
|
@@ -46080,7 +46097,7 @@ function transferRoutesFor(tool) {
|
|
|
46080
46097
|
function decodedFileBytes(value) {
|
|
46081
46098
|
return value.length / 4 * 3 - (value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0);
|
|
46082
46099
|
}
|
|
46083
|
-
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, certificateDetailsSchema, certificateInspectionSchema, trustedCredentialCertificateSchema, adminCertificateRoutes, githubConnectionInput, githubDeviceRoutes, adminToolRoutes, oidcIssuerSchema, providerSettings, entraSettings, oidcSettings, providerSettingsSchema, providerFields, adminProviderSchema, adminProviderCredentialSchema, adminProviderRoutes, roleRuleSettingsSchema, adminRoleRuleSchema, adminRoleRuleRoutes, invitationLifetimeSchema, adminInvitationSchema, invitationLinkSchema, adminInvitationRoutes, adminRoleSchema, adminRolesResponseSchema, adminRoleRoutes, toolsResponseSchema, inputFileSchema, runInputSchema, runRequestSchema, counts, runSuccessSchema, errorResponseSchema, runResponseSchema;
|
|
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;
|
|
46084
46101
|
var init_api2 = __esm({
|
|
46085
46102
|
"src/shared/api.ts"() {
|
|
46086
46103
|
"use strict";
|
|
@@ -46095,6 +46112,8 @@ var init_api2 = __esm({
|
|
|
46095
46112
|
init_unifi_axi();
|
|
46096
46113
|
init_proxmox_axi();
|
|
46097
46114
|
init_technitium_axi();
|
|
46115
|
+
init_instance();
|
|
46116
|
+
init_instance();
|
|
46098
46117
|
inputLimits = {
|
|
46099
46118
|
requestBytes: 16 * 1024 * 1024,
|
|
46100
46119
|
arguments: 64,
|
|
@@ -46146,11 +46165,13 @@ var init_api2 = __esm({
|
|
|
46146
46165
|
external_exports.strictObject({ operation: external_exports.literal("mail.attachment.save"), selector: mailSelectorSchema(3), type: external_exports.literal("attachment") })
|
|
46147
46166
|
]);
|
|
46148
46167
|
transferPrepareSchema = external_exports.strictObject({ selection: transferSelectionSchema, targetDigest: sha256Schema });
|
|
46168
|
+
transferPrepareRequestSchema = transferPrepareSchema.extend({ instance: instanceNameSchema.optional() });
|
|
46149
46169
|
transferIdSchema = external_exports.uuid();
|
|
46150
46170
|
transferScopeSchema = external_exports.strictObject({
|
|
46151
46171
|
transferId: transferIdSchema,
|
|
46152
46172
|
userId: transferOwnerIdSchema,
|
|
46153
46173
|
sessionFamilyId: transferOwnerIdSchema,
|
|
46174
|
+
credentialId: external_exports.string().min(1),
|
|
46154
46175
|
credentialRevision: external_exports.number().int().positive(),
|
|
46155
46176
|
selection: transferSelectionSchema,
|
|
46156
46177
|
targetDigest: sha256Schema,
|
|
@@ -46200,7 +46221,7 @@ var init_api2 = __esm({
|
|
|
46200
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);
|
|
46201
46222
|
transferStatusSchema = transferEvidenceSchema.safeExtend({ transferId: transferIdSchema, expiresAt: external_exports.number().int() });
|
|
46202
46223
|
transferRoutes = {
|
|
46203
|
-
prepare: { method: "POST", path: "/v1/transfers/hybrid/prepare", input:
|
|
46224
|
+
prepare: { method: "POST", path: "/v1/transfers/hybrid/prepare", input: transferPrepareRequestSchema, response: transferPreviewSchema },
|
|
46204
46225
|
execute: { method: "POST", path: "/v1/transfers/hybrid/execute", input: transferExecuteSchema, response: transferStatusSchema },
|
|
46205
46226
|
retrieve: { method: "POST", path: "/v1/transfers/hybrid/retrieve", input: transferRetrieveSchema },
|
|
46206
46227
|
receipt: { method: "POST", path: "/v1/transfers/hybrid/receipt", input: transferReceiptSchema },
|
|
@@ -46264,7 +46285,11 @@ var init_api2 = __esm({
|
|
|
46264
46285
|
accountId = external_exports.string().min(1);
|
|
46265
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"]);
|
|
46266
46287
|
delegationScopeSchema = external_exports.strictObject({
|
|
46267
|
-
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)
|
|
46268
46293
|
});
|
|
46269
46294
|
meResponseSchema = external_exports.union([
|
|
46270
46295
|
external_exports.strictObject({
|
|
@@ -46278,14 +46303,16 @@ var init_api2 = __esm({
|
|
|
46278
46303
|
external_exports.strictObject({
|
|
46279
46304
|
username: external_exports.string(),
|
|
46280
46305
|
displayName: external_exports.string(),
|
|
46281
|
-
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() })) }) }),
|
|
46282
46307
|
accessExpiresAt: external_exports.number().int(),
|
|
46283
46308
|
sessionExpiresAt: external_exports.number().int()
|
|
46284
46309
|
})
|
|
46285
46310
|
]);
|
|
46286
46311
|
createDelegationSchema = external_exports.strictObject({
|
|
46287
46312
|
label: external_exports.string().trim().min(1).max(100),
|
|
46288
|
-
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) }),
|
|
46289
46316
|
readOnly: external_exports.boolean(),
|
|
46290
46317
|
reusable: external_exports.boolean(),
|
|
46291
46318
|
expiresAt: external_exports.number().int().positive()
|
|
@@ -46462,6 +46489,7 @@ var init_api2 = __esm({
|
|
|
46462
46489
|
failed: external_exports.enum(["0", "1"]).optional(),
|
|
46463
46490
|
user: external_exports.string().min(1).max(256).optional(),
|
|
46464
46491
|
tool: toolSchema.optional(),
|
|
46492
|
+
instance: instanceNameSchema.optional(),
|
|
46465
46493
|
event: external_exports.string().min(1).max(100).optional(),
|
|
46466
46494
|
outcome: external_exports.string().min(1).max(100).optional(),
|
|
46467
46495
|
from: external_exports.iso.datetime().optional(),
|
|
@@ -46516,7 +46544,9 @@ var init_api2 = __esm({
|
|
|
46516
46544
|
archive_sha256: sha256Schema.nullable(),
|
|
46517
46545
|
native_audit_id: external_exports.string().nullable(),
|
|
46518
46546
|
native_journal_result: external_exports.string().nullable(),
|
|
46519
|
-
client_save_outcome: transferSaveOutcomeSchema.nullable()
|
|
46547
|
+
client_save_outcome: transferSaveOutcomeSchema.nullable(),
|
|
46548
|
+
credential_id: external_exports.string().nullable(),
|
|
46549
|
+
instance: external_exports.string().nullable()
|
|
46520
46550
|
});
|
|
46521
46551
|
adminAuditRoute = {
|
|
46522
46552
|
method: "GET",
|
|
@@ -46694,6 +46724,22 @@ var init_api2 = __esm({
|
|
|
46694
46724
|
normalizations: external_exports.array(external_exports.strictObject({ field: external_exports.string(), reason: external_exports.string() })).optional()
|
|
46695
46725
|
});
|
|
46696
46726
|
adminToolParamsSchema = external_exports.strictObject({ tool: toolSchema });
|
|
46727
|
+
adminInstanceParamsSchema = adminToolParamsSchema.extend({ name: instanceNameSchema });
|
|
46728
|
+
adminInstanceSchema = external_exports.strictObject({
|
|
46729
|
+
id: external_exports.string(),
|
|
46730
|
+
tool: toolSchema,
|
|
46731
|
+
name: instanceNameSchema,
|
|
46732
|
+
description: external_exports.string().max(500),
|
|
46733
|
+
enabled: external_exports.boolean(),
|
|
46734
|
+
readOnly: external_exports.boolean(),
|
|
46735
|
+
configured: external_exports.boolean(),
|
|
46736
|
+
metadata: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
46737
|
+
revision: external_exports.number().int().positive(),
|
|
46738
|
+
updatedAt: external_exports.number().int().nullable(),
|
|
46739
|
+
updatedBy: accountId.nullable(),
|
|
46740
|
+
health: healthSchema,
|
|
46741
|
+
normalizations: adminCredentialSchema.shape.normalizations
|
|
46742
|
+
});
|
|
46697
46743
|
certificateDetailsSchema = external_exports.strictObject({
|
|
46698
46744
|
subject: external_exports.string(),
|
|
46699
46745
|
issuer: external_exports.string(),
|
|
@@ -46765,7 +46811,9 @@ var init_api2 = __esm({
|
|
|
46765
46811
|
input: external_exports.strictObject({
|
|
46766
46812
|
origin: external_exports.string(),
|
|
46767
46813
|
expectedRevision: external_exports.number().int().nonnegative(),
|
|
46768
|
-
expectedToolRevision: external_exports.number().int().positive()
|
|
46814
|
+
expectedToolRevision: external_exports.number().int().positive(),
|
|
46815
|
+
instance: instanceNameSchema.optional(),
|
|
46816
|
+
expectedId: external_exports.string().optional()
|
|
46769
46817
|
}),
|
|
46770
46818
|
response: external_exports.strictObject({
|
|
46771
46819
|
connectionId: external_exports.uuid(),
|
|
@@ -46781,7 +46829,7 @@ var init_api2 = __esm({
|
|
|
46781
46829
|
input: githubConnectionInput,
|
|
46782
46830
|
response: external_exports.union([
|
|
46783
46831
|
external_exports.strictObject({ status: external_exports.literal("pending"), interval: external_exports.number().int().positive() }),
|
|
46784
|
-
external_exports.strictObject({ status: external_exports.literal("connected"), credential: adminCredentialSchema })
|
|
46832
|
+
external_exports.strictObject({ status: external_exports.literal("connected"), credential: external_exports.union([adminCredentialSchema, adminInstanceSchema]) })
|
|
46785
46833
|
])
|
|
46786
46834
|
},
|
|
46787
46835
|
cancel: {
|
|
@@ -46850,9 +46898,11 @@ var init_api2 = __esm({
|
|
|
46850
46898
|
input: external_exports.strictObject({
|
|
46851
46899
|
origin: external_exports.string(),
|
|
46852
46900
|
expectedRevision: external_exports.number().int().nonnegative(),
|
|
46853
|
-
expectedToolRevision: external_exports.number().int().positive()
|
|
46901
|
+
expectedToolRevision: external_exports.number().int().positive(),
|
|
46902
|
+
instance: instanceNameSchema.optional(),
|
|
46903
|
+
expectedId: external_exports.string().optional()
|
|
46854
46904
|
}),
|
|
46855
|
-
response: adminCredentialSchema,
|
|
46905
|
+
response: external_exports.union([adminCredentialSchema, adminInstanceSchema]),
|
|
46856
46906
|
authorization: "administrator-and-recent-auth",
|
|
46857
46907
|
auditEvent: "save-awx-origin"
|
|
46858
46908
|
},
|
|
@@ -46904,6 +46954,63 @@ var init_api2 = __esm({
|
|
|
46904
46954
|
auditEvent: "credential-test"
|
|
46905
46955
|
}
|
|
46906
46956
|
};
|
|
46957
|
+
instanceBase = "/v1/admin/tools/:tool/instances";
|
|
46958
|
+
instanceRevisions = { expectedId: external_exports.string(), expectedRevision: external_exports.number().int().positive() };
|
|
46959
|
+
adminInstanceRoutes = {
|
|
46960
|
+
list: {
|
|
46961
|
+
method: "GET",
|
|
46962
|
+
path: instanceBase,
|
|
46963
|
+
input: external_exports.strictObject({}),
|
|
46964
|
+
response: external_exports.strictObject({ instances: external_exports.array(adminInstanceSchema) })
|
|
46965
|
+
},
|
|
46966
|
+
create: {
|
|
46967
|
+
method: "POST",
|
|
46968
|
+
path: instanceBase,
|
|
46969
|
+
input: external_exports.strictObject({
|
|
46970
|
+
name: instanceNameSchema,
|
|
46971
|
+
description: external_exports.string().max(500).default(""),
|
|
46972
|
+
value: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
46973
|
+
expectedToolRevision: external_exports.number().int().positive()
|
|
46974
|
+
}),
|
|
46975
|
+
response: adminInstanceSchema,
|
|
46976
|
+
auditEvent: "create-instance"
|
|
46977
|
+
},
|
|
46978
|
+
get: { method: "GET", path: `${instanceBase}/:name`, input: external_exports.strictObject({}), response: adminInstanceSchema },
|
|
46979
|
+
update: {
|
|
46980
|
+
method: "PATCH",
|
|
46981
|
+
path: `${instanceBase}/:name`,
|
|
46982
|
+
input: external_exports.strictObject({
|
|
46983
|
+
...instanceRevisions,
|
|
46984
|
+
enabled: external_exports.boolean().optional(),
|
|
46985
|
+
readOnly: external_exports.boolean().optional(),
|
|
46986
|
+
description: external_exports.string().max(500).optional()
|
|
46987
|
+
}).refine((input2) => input2.enabled !== void 0 || input2.readOnly !== void 0 || input2.description !== void 0),
|
|
46988
|
+
response: adminInstanceSchema
|
|
46989
|
+
},
|
|
46990
|
+
remove: {
|
|
46991
|
+
method: "DELETE",
|
|
46992
|
+
path: `${instanceBase}/:name`,
|
|
46993
|
+
input: external_exports.strictObject(instanceRevisions),
|
|
46994
|
+
response: external_exports.strictObject({ removed: external_exports.literal(true) }),
|
|
46995
|
+
auditEvent: "delete-instance"
|
|
46996
|
+
},
|
|
46997
|
+
replace: {
|
|
46998
|
+
method: "PUT",
|
|
46999
|
+
path: `${instanceBase}/:name/credential`,
|
|
47000
|
+
input: external_exports.strictObject({ ...instanceRevisions, value: external_exports.unknown(), expectedToolRevision: external_exports.number().int().positive() }),
|
|
47001
|
+
response: adminInstanceSchema,
|
|
47002
|
+
auditEvent: "replace-credential"
|
|
47003
|
+
},
|
|
47004
|
+
save: {
|
|
47005
|
+
method: "PATCH",
|
|
47006
|
+
path: `${instanceBase}/:name/credential`,
|
|
47007
|
+
input: external_exports.strictObject({ ...instanceRevisions, value: external_exports.record(external_exports.string(), external_exports.unknown()), expectedToolRevision: external_exports.number().int().positive() }),
|
|
47008
|
+
response: adminInstanceSchema,
|
|
47009
|
+
auditEvent: "replace-credential"
|
|
47010
|
+
},
|
|
47011
|
+
test: { method: "POST", path: `${instanceBase}/:name/test`, input: external_exports.strictObject({}), response: healthSchema },
|
|
47012
|
+
certificates: Object.fromEntries(Object.entries(adminCertificateRoutes).map(([name, route]) => [name, { ...route, path: route.path.replace("/:tool/", "/:tool/instances/:name/") }]))
|
|
47013
|
+
};
|
|
46907
47014
|
oidcIssuerSchema = external_exports.url().refine((value) => {
|
|
46908
47015
|
const url2 = new URL(value);
|
|
46909
47016
|
return url2.protocol === "https:" && !url2.username && !url2.password && !url2.search && !url2.hash;
|
|
@@ -47074,6 +47181,7 @@ var init_api2 = __esm({
|
|
|
47074
47181
|
id: accountId,
|
|
47075
47182
|
name: external_exports.string().min(1),
|
|
47076
47183
|
tools: external_exports.array(toolSchema),
|
|
47184
|
+
instanceGrants: external_exports.array(external_exports.strictObject({ tool: toolSchema, instances: external_exports.array(instanceNameSchema) })),
|
|
47077
47185
|
revision: external_exports.number().int().positive(),
|
|
47078
47186
|
updatedAt: external_exports.number().int().nullable(),
|
|
47079
47187
|
updatedBy: accountId.nullable()
|
|
@@ -47135,8 +47243,21 @@ var init_api2 = __esm({
|
|
|
47135
47243
|
response: adminRoleSchema,
|
|
47136
47244
|
authorization: "administrator-and-recent-auth",
|
|
47137
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"
|
|
47138
47258
|
}
|
|
47139
47259
|
};
|
|
47260
|
+
adminRoleToolParamsSchema = adminUserParamsSchema.extend({ tool: toolSchema });
|
|
47140
47261
|
toolsResponseSchema = external_exports.strictObject({
|
|
47141
47262
|
tools: external_exports.array(external_exports.strictObject({
|
|
47142
47263
|
name: toolSchema,
|
|
@@ -47144,7 +47265,14 @@ var init_api2 = __esm({
|
|
|
47144
47265
|
readOnly: external_exports.boolean().default(true),
|
|
47145
47266
|
status: external_exports.enum(["unconfigured", "unknown", "checking", "ok", "error", "disabled"]),
|
|
47146
47267
|
errorCode: healthSchema.shape.errorCode.optional(),
|
|
47147
|
-
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
|
+
}))
|
|
47148
47276
|
}))
|
|
47149
47277
|
});
|
|
47150
47278
|
inputFileSchema = external_exports.strictObject({
|
|
@@ -47165,11 +47293,13 @@ var init_api2 = __esm({
|
|
|
47165
47293
|
).optional()
|
|
47166
47294
|
});
|
|
47167
47295
|
runRequestSchema = runInputSchema.extend({
|
|
47296
|
+
instance: instanceNameSchema.optional(),
|
|
47168
47297
|
args: external_exports.array(text.refine((value) => byteLength(value) <= inputLimits.argumentBytes, "Argument exceeds byte limit")).max(inputLimits.arguments)
|
|
47169
47298
|
});
|
|
47170
47299
|
counts = external_exports.strictObject({ stdout: external_exports.number().int().nonnegative(), stderr: external_exports.number().int().nonnegative() });
|
|
47171
47300
|
runSuccessSchema = external_exports.strictObject({
|
|
47172
47301
|
source: toolSchema,
|
|
47302
|
+
instance: instanceNameSchema.optional(),
|
|
47173
47303
|
stdout: external_exports.string(),
|
|
47174
47304
|
stderr: external_exports.string(),
|
|
47175
47305
|
exitCode: external_exports.number().int().nonnegative(),
|
|
@@ -99956,22 +100086,34 @@ function sessionExpiryView(expiresAt, now = Date.now()) {
|
|
|
99956
100086
|
}
|
|
99957
100087
|
function toolsView(tools) {
|
|
99958
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";
|
|
99959
|
-
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(" ")}
|
|
99960
100090
|
`;
|
|
99961
|
-
return `tools[${tools.length}]{name,status,version,readOnly}:
|
|
99962
|
-
${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")}
|
|
99963
100093
|
next[${example ? 2 : 1}]:
|
|
99964
100094
|
- artium-axi tools show ${tools[0].name}
|
|
99965
100095
|
${example}`;
|
|
99966
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
|
+
}
|
|
99967
100107
|
function toolView(tool) {
|
|
99968
100108
|
const manifest = toolManifests[tool.name];
|
|
99969
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> ";
|
|
99970
100111
|
if (tool.commands) return `tool: ${tool.name}
|
|
99971
100112
|
version: ${JSON.stringify(tool.version)}
|
|
99972
100113
|
status: ${tool.status}
|
|
99973
100114
|
readOnly: ${tool.readOnly ?? true}
|
|
99974
|
-
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} ...
|
|
99975
100117
|
`;
|
|
99976
100118
|
const commands3 = manifest.discovery.commands;
|
|
99977
100119
|
const help2 = rewriteDiscoveryHelp(manifest.discovery.help, tool.name);
|
|
@@ -99979,8 +100121,8 @@ commands[${tool.commands.length}]: ${tool.commands.map((command) => JSON.stringi
|
|
|
99979
100121
|
version: ${JSON.stringify(tool.version)}
|
|
99980
100122
|
status: ${tool.status}
|
|
99981
100123
|
readOnly: ${tool.readOnly ?? true}
|
|
99982
|
-
commands[${commands3.length}]: ${commands3.join(",")}
|
|
99983
|
-
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(" ")}
|
|
99984
100126
|
upstreamHelp: ${JSON.stringify(help2)}
|
|
99985
100127
|
`;
|
|
99986
100128
|
}
|
|
@@ -100121,7 +100263,7 @@ ${protocol.map((line) => ` - ${JSON.stringify(line)}`).join("\n")}
|
|
|
100121
100263
|
function validateArguments(args2, prefixHelp) {
|
|
100122
100264
|
const command = args2[0];
|
|
100123
100265
|
if (command === "tools") args2 = [...args2.filter((arg) => arg !== "--help"), ...args2.filter((arg) => arg === "--help")];
|
|
100124
|
-
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)";
|
|
100125
100267
|
const rootCommands = Object.keys(commands).filter((name) => name !== "home" && name !== "managed-session" && name !== "tools show").join(", ");
|
|
100126
100268
|
function fail(token, level2, choices2) {
|
|
100127
100269
|
const kind = token?.startsWith("-") ? "flag" : "argument";
|
|
@@ -100245,7 +100387,15 @@ var init_help = __esm({
|
|
|
100245
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."],
|
|
100246
100388
|
example: "artium-axi gh-axi repo list --limit 1"
|
|
100247
100389
|
},
|
|
100248
|
-
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
|
+
},
|
|
100249
100399
|
setup: {
|
|
100250
100400
|
usage: "artium-axi setup --host <claude|codex|opencode|pi> [--hook] [--force]",
|
|
100251
100401
|
purpose: "Install skills for your signed-in account\u2019s granted tools and optional ambient context for Claude Code, Codex or OpenCode.",
|
|
@@ -101342,7 +101492,9 @@ var init_proxmox_stream = __esm({
|
|
|
101342
101492
|
"use strict";
|
|
101343
101493
|
init_zod();
|
|
101344
101494
|
init_websocket();
|
|
101495
|
+
init_api2();
|
|
101345
101496
|
proxmoxStreamStart = external_exports.strictObject({
|
|
101497
|
+
instance: instanceNameSchema.optional(),
|
|
101346
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),
|
|
101347
101499
|
stdin: external_exports.string().max(65536).optional(),
|
|
101348
101500
|
source: external_exports.strictObject({ bytes: external_exports.number().int().min(0), sha256: external_exports.string().regex(/^[a-f0-9]{64}$/) }).optional()
|
|
@@ -101467,7 +101619,7 @@ async function openProxmoxStream(client, id, token, signal) {
|
|
|
101467
101619
|
request.end();
|
|
101468
101620
|
});
|
|
101469
101621
|
}
|
|
101470
|
-
async function proxmoxStream(createClient, supplied, output3) {
|
|
101622
|
+
async function proxmoxStream(createClient, supplied, output3, instance) {
|
|
101471
101623
|
if (supplied[0] !== "stream") return false;
|
|
101472
101624
|
const usage = "artium-axi proxmox-axi stream -- transfer|duplex <native arguments>";
|
|
101473
101625
|
const { separator, json: json2, options, args: args2, route } = resolveProxmoxStream(supplied);
|
|
@@ -101537,6 +101689,7 @@ async function proxmoxStream(createClient, supplied, output3) {
|
|
|
101537
101689
|
}
|
|
101538
101690
|
const response = leaseSchema.safeParse(await client.authenticated("/v1/tools/proxmox-axi/streams", "POST", {
|
|
101539
101691
|
args: input2.args,
|
|
101692
|
+
...instance === void 0 ? {} : { instance },
|
|
101540
101693
|
...input2.stdin === void 0 ? {} : { stdin: input2.stdin },
|
|
101541
101694
|
...sourceInfo ? { source: sourceInfo } : {}
|
|
101542
101695
|
}));
|
|
@@ -101710,7 +101863,7 @@ var init_proxmox_stream2 = __esm({
|
|
|
101710
101863
|
});
|
|
101711
101864
|
|
|
101712
101865
|
// src/cli/shodan-session.ts
|
|
101713
|
-
async function shodanSession(args2, createClient, output3) {
|
|
101866
|
+
async function shodanSession(args2, createClient, output3, instance) {
|
|
101714
101867
|
if (args2[0] !== "stream" || args2[1] !== "session") return false;
|
|
101715
101868
|
if (args2.includes("--help")) {
|
|
101716
101869
|
output3("stdout", help);
|
|
@@ -101755,6 +101908,7 @@ async function shodanSession(args2, createClient, output3) {
|
|
|
101755
101908
|
stop: []
|
|
101756
101909
|
};
|
|
101757
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.");
|
|
101758
101912
|
const number4 = (name) => {
|
|
101759
101913
|
const value = values.get(name);
|
|
101760
101914
|
if (value === void 0) return void 0;
|
|
@@ -101780,7 +101934,7 @@ async function shodanSession(args2, createClient, output3) {
|
|
|
101780
101934
|
}, acceptUnknownCost: true });
|
|
101781
101935
|
if (!parsed.success || action === "start" && !external_exports.uuid().safeParse(values.get("--confirm")).success) throw new ArtiumError("INVALID_INPUT");
|
|
101782
101936
|
path += `/${action}`;
|
|
101783
|
-
body = { ...parsed.data, ...action === "start" ? { confirm: values.get("--confirm") } : {} };
|
|
101937
|
+
body = { ...parsed.data, ...action === "start" ? { confirm: values.get("--confirm") } : {}, ...instance === void 0 ? {} : { instance } };
|
|
101784
101938
|
} else {
|
|
101785
101939
|
if (positional.length !== 1 || !external_exports.uuid().safeParse(positional[0]).success) throw new ArtiumError("INVALID_INPUT");
|
|
101786
101940
|
path += `/${positional[0]}`;
|
|
@@ -102098,7 +102252,7 @@ var init_shodan_radar = __esm({
|
|
|
102098
102252
|
});
|
|
102099
102253
|
|
|
102100
102254
|
// src/cli/shodan-scan.ts
|
|
102101
|
-
async function shodanScan(args2, createClient, output3) {
|
|
102255
|
+
async function shodanScan(args2, createClient, output3, instance) {
|
|
102102
102256
|
if (args2[0] !== "scan" || args2[1] !== "submit") return false;
|
|
102103
102257
|
if (args2.includes("--help")) {
|
|
102104
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");
|
|
@@ -102151,7 +102305,7 @@ async function shodanScan(args2, createClient, output3) {
|
|
|
102151
102305
|
if (!parsed.success) throw new ArtiumError("INVALID_INPUT");
|
|
102152
102306
|
const client = createClient();
|
|
102153
102307
|
await client.authenticated("/v1/me", "GET");
|
|
102154
|
-
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));
|
|
102155
102309
|
if (!switches.has("--execute")) {
|
|
102156
102310
|
const result2 = await call(prefix + "/preview", parsed.data);
|
|
102157
102311
|
output3("stdout", (switches.has("--json") ? JSON.stringify(result2) : encode(result2)) + "\n");
|
|
@@ -102717,11 +102871,13 @@ async function sessionContext() {
|
|
|
102717
102871
|
const parsed = toolsResponseSchema.safeParse(await client.authenticated("/v1/tools", "GET", void 0, previous));
|
|
102718
102872
|
if (!parsed.success) throw new ArtiumError("INVALID_RESPONSE");
|
|
102719
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.";
|
|
102720
102876
|
return `artium: available
|
|
102721
|
-
tools[${tools.length}]{name,status,readOnly}:
|
|
102722
|
-
${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")}
|
|
102723
102879
|
next: artium-axi tools
|
|
102724
|
-
note:
|
|
102880
|
+
note: ${note}
|
|
102725
102881
|
`;
|
|
102726
102882
|
} catch (error62) {
|
|
102727
102883
|
const code = error62 instanceof ArtiumError ? error62.code : "INTERNAL_ERROR";
|
|
@@ -102742,6 +102898,7 @@ var init_session_context = __esm({
|
|
|
102742
102898
|
init_api2();
|
|
102743
102899
|
init_errors3();
|
|
102744
102900
|
init_http();
|
|
102901
|
+
init_views();
|
|
102745
102902
|
}
|
|
102746
102903
|
});
|
|
102747
102904
|
|
|
@@ -103414,7 +103571,7 @@ async function fileBytes(path, limit = 100 * 1024 * 1024) {
|
|
|
103414
103571
|
await file2.close();
|
|
103415
103572
|
}
|
|
103416
103573
|
}
|
|
103417
|
-
async function kubernetesHosted(args2, createClient, write, permittedCommands) {
|
|
103574
|
+
async function kubernetesHosted(args2, createClient, write, permittedCommands, instance) {
|
|
103418
103575
|
let prefix2 = 0;
|
|
103419
103576
|
while (args2[prefix2] === "--json") prefix2++;
|
|
103420
103577
|
if (args2[prefix2] === "tunnel") return kubernetesTunnel(createClient, [...args2.slice(prefix2), ...prefix2 ? ["--json"] : []], (text2) => write(text2));
|
|
@@ -103443,6 +103600,7 @@ async function kubernetesHosted(args2, createClient, write, permittedCommands) {
|
|
|
103443
103600
|
return false;
|
|
103444
103601
|
}
|
|
103445
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");
|
|
103446
103604
|
const print = (value) => write((prefix2 || flags.has("--json") ? JSON.stringify(value) : encode(value)) + "\n");
|
|
103447
103605
|
if (help2) {
|
|
103448
103606
|
const kinds = (permittedCommands ?? []).filter((command) => command.startsWith("session start ")).map((command) => command.slice("session start ".length));
|
|
@@ -103491,7 +103649,7 @@ async function kubernetesHosted(args2, createClient, write, permittedCommands) {
|
|
|
103491
103649
|
}
|
|
103492
103650
|
};
|
|
103493
103651
|
await visit2(root);
|
|
103494
|
-
const manifest = validated(kubernetesWorkspaceManifest, { files });
|
|
103652
|
+
const manifest = validated(kubernetesWorkspaceManifest, { files, instance });
|
|
103495
103653
|
const workspace = validated(workspaceSchema, await call(base2, "POST", manifest), "INVALID_RESPONSE");
|
|
103496
103654
|
try {
|
|
103497
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)));
|
|
@@ -103516,6 +103674,7 @@ async function kubernetesHosted(args2, createClient, write, permittedCommands) {
|
|
|
103516
103674
|
const kind = positionals[0];
|
|
103517
103675
|
const input2 = validated(kubernetesSessionStart, {
|
|
103518
103676
|
kind,
|
|
103677
|
+
instance,
|
|
103519
103678
|
argv: ["watch", "logs"].includes(kind) ? native : ["prepare", "--", ...native],
|
|
103520
103679
|
workspace: flags.get("--workspace"),
|
|
103521
103680
|
...flags.has("--stdin-file") ? { stdinBase64: (await fileBytes(flags.get("--stdin-file"), 512 * 1024)).toString("base64") } : {},
|
|
@@ -103605,7 +103764,7 @@ import { setTimeout as delay2 } from "node:timers/promises";
|
|
|
103605
103764
|
async function tokenCommand(args2, output3, managed2) {
|
|
103606
103765
|
const action = args2[0];
|
|
103607
103766
|
if (args2.includes("--help")) {
|
|
103608
|
-
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");
|
|
103609
103768
|
return;
|
|
103610
103769
|
}
|
|
103611
103770
|
if (managed2) throw new ArtiumError("INVALID_INPUT", "Token management is unavailable in managed mode.");
|
|
@@ -103624,7 +103783,7 @@ async function tokenCommand(args2, output3, managed2) {
|
|
|
103624
103783
|
action === "list" ? "Use artium-axi token list; valid flags: --help." : "Use artium-axi token revoke <id>; valid flags: --help."
|
|
103625
103784
|
);
|
|
103626
103785
|
if (action !== "create") throw new ArtiumError("INVALID_INPUT", "Invalid token command.", "Use artium-axi token --help.");
|
|
103627
|
-
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"];
|
|
103628
103787
|
const flags = /* @__PURE__ */ new Map();
|
|
103629
103788
|
for (let index = 1; index < args2.length; index++) {
|
|
103630
103789
|
const flag = args2[index];
|
|
@@ -103634,7 +103793,7 @@ async function tokenCommand(args2, output3, managed2) {
|
|
|
103634
103793
|
`Valid flags: --help, ${createFlags.join(", ")}.`
|
|
103635
103794
|
);
|
|
103636
103795
|
const values = flags.get(flag) ?? [];
|
|
103637
|
-
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");
|
|
103638
103797
|
const value = ["--write", "--reusable", "--password-stdin", "--sso"].includes(flag) ? "true" : args2[++index];
|
|
103639
103798
|
if (!value || value.startsWith("--")) throw new ArtiumError("INVALID_INPUT");
|
|
103640
103799
|
if (["--exact", "--command"].includes(flag) && value.includes("*")) throw new ArtiumError(
|
|
@@ -103659,7 +103818,17 @@ async function tokenCommand(args2, output3, managed2) {
|
|
|
103659
103818
|
if (separator < 0) throw new ArtiumError("INVALID_INPUT");
|
|
103660
103819
|
return { tool: readTool(value.slice(0, separator)), commands: [value.slice(separator + 1)] };
|
|
103661
103820
|
});
|
|
103662
|
-
|
|
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
|
+
}
|
|
103663
103832
|
const fdText = flags.get("--token-fd")?.[0];
|
|
103664
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.");
|
|
103665
103834
|
const fd = fdText === void 0 ? 1 : Number(fdText);
|
|
@@ -103703,7 +103872,7 @@ code: ${start.userCode}
|
|
|
103703
103872
|
const { ticket } = reauthResponseSchema.parse(proof);
|
|
103704
103873
|
const response = createdDelegationSchema.parse(await client.request("/v1/account/tokens", "POST", {
|
|
103705
103874
|
label,
|
|
103706
|
-
scope: { tools:
|
|
103875
|
+
scope: { tools: selections },
|
|
103707
103876
|
readOnly: !flags.has("--write"),
|
|
103708
103877
|
reusable: flags.has("--reusable"),
|
|
103709
103878
|
expiresAt
|
|
@@ -103735,7 +103904,31 @@ function output2(stream, text2) {
|
|
|
103735
103904
|
if (managed) managed.write(stream, text2);
|
|
103736
103905
|
else process[stream].write(text2);
|
|
103737
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
|
+
}
|
|
103738
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
|
+
}
|
|
103739
103932
|
if (args2.length === 2 && args2.includes("--managed-session") && args2.includes("--help")) {
|
|
103740
103933
|
output2("stdout", commandHelp("managed-session"));
|
|
103741
103934
|
return;
|
|
@@ -103744,6 +103937,10 @@ async function main(args2) {
|
|
|
103744
103937
|
validateArguments(localArgs[0] === "--help" ? localArgs.slice(1) : localArgs, localArgs[0] === "--help");
|
|
103745
103938
|
const managedMode = args2[0] === "--managed-session";
|
|
103746
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
|
+
}
|
|
103747
103944
|
if (args2.length === 1 && ["--version", "-v", "-V"].includes(args2[0])) {
|
|
103748
103945
|
output2("stdout", `${cliVersion}
|
|
103749
103946
|
`);
|
|
@@ -103792,6 +103989,9 @@ async function main(args2) {
|
|
|
103792
103989
|
const { tools } = toolsResponseSchema.parse(await client2.authenticated("/v1/tools", "GET"));
|
|
103793
103990
|
if (tools.some((tool) => tool.commands === void 0)) throw new ArtiumError("INVALID_RESPONSE");
|
|
103794
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
|
+
}
|
|
103795
103995
|
if (help2 === "download" || downloadOperation) {
|
|
103796
103996
|
const operations = transferSelectionSchema.options.map((option) => option.shape.operation.value).filter((operation) => tools.some((tool) => tool.name === transferTool(operation) && tool.commands?.includes(operation)));
|
|
103797
103997
|
if (downloadOperation && !operations.includes(downloadOperation)) throw new ArtiumError("DELEGATED_SCOPE_DENIED");
|
|
@@ -103817,16 +104017,19 @@ async function main(args2) {
|
|
|
103817
104017
|
return;
|
|
103818
104018
|
}
|
|
103819
104019
|
if (!stream.route || !tool.commands?.includes(stream.route.command)) throw new ArtiumError("DELEGATED_SCOPE_DENIED");
|
|
103820
|
-
await proxmoxStream(() => client2, hostedArgs, output2);
|
|
104020
|
+
await proxmoxStream(() => client2, hostedArgs, output2, instance);
|
|
103821
104021
|
return;
|
|
103822
104022
|
}
|
|
103823
104023
|
const hosted = name === "kubernetes-axi" ? resolveKubernetesHostedCommand(hostedArgs) : void 0;
|
|
103824
104024
|
if (hosted && kubernetesHostedRoutes.some((route) => route.command === hosted)) {
|
|
103825
104025
|
if (!tool?.commands?.includes(hosted)) throw new ArtiumError("DELEGATED_SCOPE_DENIED");
|
|
103826
|
-
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);
|
|
103827
104027
|
return;
|
|
103828
104028
|
}
|
|
103829
|
-
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);
|
|
103830
104033
|
if (!parsed.success || parsed.data.source !== name) throw new ArtiumError("INVALID_RESPONSE");
|
|
103831
104034
|
const { truncated } = parsed.data;
|
|
103832
104035
|
if (truncated.stdout || truncated.stderr) output2("stderr", `artium-axi: output truncated (${["stdout", "stderr"].filter((stream) => truncated[stream]).join(", ")}).
|
|
@@ -104002,13 +104205,18 @@ remoteRevocation: ${verified ? "verified" : "unverified"}
|
|
|
104002
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.");
|
|
104003
104206
|
}
|
|
104004
104207
|
if (command === "ssh-axi" && await sshExecution(args2.slice(1), () => new Client(process.env, managed), (text2) => output2("stdout", text2))) return;
|
|
104005
|
-
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;
|
|
104006
104210
|
if (command === "proxmox-axi" && await proxmoxPrivateResult(() => new Client(process.env, managed), args2.slice(1), (text2) => output2("stdout", text2))) return;
|
|
104007
|
-
if (command === "proxmox-axi" && await proxmoxStream(() => new Client(process.env, managed), args2.slice(1), output2)) return;
|
|
104008
|
-
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;
|
|
104009
104215
|
if (command === "shodan-axi" && await shodanRadar(args2.slice(1), () => new Client(process.env, managed), output2)) return;
|
|
104010
|
-
if (command === "shodan-axi" && await shodanScan(args2.slice(1), () => new Client(process.env, managed), output2))
|
|
104011
|
-
|
|
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 } };
|
|
104012
104220
|
const client = new Client(process.env, managed);
|
|
104013
104221
|
const homeSession = home && !managed ? client.sessions.read() : void 0;
|
|
104014
104222
|
if (home && !managed && !homeSession) throw new ArtiumError("TOKEN_INVALID", void 0, "Run artium-axi login --username <username> --password-stdin.");
|
|
@@ -104016,7 +104224,7 @@ remoteRevocation: ${verified ? "verified" : "unverified"}
|
|
|
104016
104224
|
client.authenticated(home || whoami ? "/v1/me" : `/v1/tools${listing ? "" : `/${command}/run`}`, home || listing || whoami ? "GET" : "POST", input2, homeSession),
|
|
104017
104225
|
home ? client.authenticated("/v1/tools", "GET", void 0, homeSession) : void 0
|
|
104018
104226
|
])).map((response) => {
|
|
104019
|
-
if (response.status === "rejected") throw response.reason;
|
|
104227
|
+
if (response.status === "rejected") throw instanceErrorAdvice(response.reason, instance);
|
|
104020
104228
|
return response.value;
|
|
104021
104229
|
});
|
|
104022
104230
|
if (home || whoami) {
|