@armoriq/sdk-dev 0.2.15 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/auth.d.ts +15 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +259 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/keys.d.ts +14 -0
- package/dist/cli/commands/keys.d.ts.map +1 -0
- package/dist/cli/commands/keys.js +132 -0
- package/dist/cli/commands/keys.js.map +1 -0
- package/dist/cli/commands/orgs.d.ts +10 -0
- package/dist/cli/commands/orgs.d.ts.map +1 -0
- package/dist/cli/commands/orgs.js +152 -0
- package/dist/cli/commands/orgs.js.map +1 -0
- package/dist/cli/commands/status.d.ts +9 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +103 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +141 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/state.d.ts +22 -0
- package/dist/cli/state.d.ts.map +1 -0
- package/dist/cli/state.js +91 -0
- package/dist/cli/state.js.map +1 -0
- package/dist/cli/util.d.ts +19 -0
- package/dist/cli/util.d.ts.map +1 -0
- package/dist/cli/util.js +107 -0
- package/dist/cli/util.js.map +1 -0
- package/dist/client.d.ts +73 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +289 -5
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +64 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +215 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/integrations/google_adk.d.ts +113 -0
- package/dist/integrations/google_adk.d.ts.map +1 -0
- package/dist/integrations/google_adk.js +319 -0
- package/dist/integrations/google_adk.js.map +1 -0
- package/dist/models.d.ts +36 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/plan_builder.d.ts +53 -0
- package/dist/plan_builder.d.ts.map +1 -0
- package/dist/plan_builder.js +110 -0
- package/dist/plan_builder.js.map +1 -0
- package/dist/session.d.ts +87 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +490 -0
- package/dist/session.js.map +1 -0
- package/package.json +9 -2
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* armoriq status / logs — local-only commands that read the cached state
|
|
4
|
+
* and CLI log file. Mirrors armoriq_sdk/cli.py:cmd_status / cmd_logs.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.cmdStatus = cmdStatus;
|
|
41
|
+
exports.cmdLogs = cmdLogs;
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const util_1 = require("../util");
|
|
44
|
+
const state_1 = require("../state");
|
|
45
|
+
function cmdStatus() {
|
|
46
|
+
const state = (0, state_1.loadState)();
|
|
47
|
+
if (!state || Object.keys(state).length === 0) {
|
|
48
|
+
(0, util_1.out)('No local registration state found. Run `armoriq register` first.');
|
|
49
|
+
return 1;
|
|
50
|
+
}
|
|
51
|
+
(0, util_1.out)(`Agent: ${state.agent_id ?? 'unknown'}`);
|
|
52
|
+
(0, util_1.out)(`User: ${state.user_id ?? 'unknown'}`);
|
|
53
|
+
(0, util_1.out)(`Environment: ${state.environment ?? 'unknown'}`);
|
|
54
|
+
(0, util_1.out)(`Registered at: ${state.registered_at ?? 'unknown'}`);
|
|
55
|
+
(0, util_1.out)(`Proxy endpoint: ${state.proxy_endpoint ?? 'unknown'}`);
|
|
56
|
+
const mcpServers = state.mcp_servers ?? [];
|
|
57
|
+
(0, util_1.out)(`MCP servers: ${mcpServers.length > 0 ? mcpServers.join(', ') : '(none)'}`);
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
function cmdLogs(args) {
|
|
61
|
+
if (!fs.existsSync(state_1.LOG_FILE)) {
|
|
62
|
+
(0, util_1.out)('No CLI logs found yet.');
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
const tailFile = (offset) => {
|
|
66
|
+
const stat = fs.statSync(state_1.LOG_FILE);
|
|
67
|
+
if (stat.size <= offset)
|
|
68
|
+
return offset;
|
|
69
|
+
const fd = fs.openSync(state_1.LOG_FILE, 'r');
|
|
70
|
+
const buf = Buffer.alloc(stat.size - offset);
|
|
71
|
+
fs.readSync(fd, buf, 0, buf.length, offset);
|
|
72
|
+
fs.closeSync(fd);
|
|
73
|
+
for (const line of buf.toString('utf-8').split('\n')) {
|
|
74
|
+
const trimmed = line.trim();
|
|
75
|
+
if (!trimmed)
|
|
76
|
+
continue;
|
|
77
|
+
try {
|
|
78
|
+
const event = JSON.parse(trimmed);
|
|
79
|
+
(0, util_1.out)(`[${event.timestamp ?? ''}] ${event.event ?? ''}: ${JSON.stringify(event.details ?? {})}`);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
(0, util_1.out)(trimmed);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return stat.size;
|
|
86
|
+
};
|
|
87
|
+
let offset = tailFile(0);
|
|
88
|
+
if (!args.follow)
|
|
89
|
+
return 0;
|
|
90
|
+
// Simple poll loop for --follow; ctrl-C exits.
|
|
91
|
+
const interval = setInterval(() => {
|
|
92
|
+
offset = tailFile(offset);
|
|
93
|
+
}, 1000);
|
|
94
|
+
// Return a never-resolving promise via process exit hook isn't useful here;
|
|
95
|
+
// the user expects --follow to block. Keep the process alive until SIGINT.
|
|
96
|
+
process.on('SIGINT', () => {
|
|
97
|
+
clearInterval(interval);
|
|
98
|
+
process.exit(0);
|
|
99
|
+
});
|
|
100
|
+
// Block forever — this function is the entrypoint of the command.
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMH,8B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,EAAE;QAChC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC,EAAE,IAAI,CAAC,CAAC;IACT,4EAA4E;IAC5E,2EAA2E;IAC3E,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,aAAa,CAAC,QAAQ,CAAC,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,kEAAkE;IAClE,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* armoriq — TypeScript CLI for the ArmorIQ SDK.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the PY CLI command surface from armoriq_sdk/cli.py and cli_auth.py.
|
|
6
|
+
* Supports: login, logout, whoami, orgs, switch-org, status, logs, keys.
|
|
7
|
+
*
|
|
8
|
+
* Note: `init`, `validate`, and `register` (which need MCP JSON-RPC discovery)
|
|
9
|
+
* are not yet implemented in TS — direct users to the PY CLI for those flows
|
|
10
|
+
* (or stay tuned for follow-up parity work).
|
|
11
|
+
*/
|
|
12
|
+
type Argv = string[];
|
|
13
|
+
declare function run(argv: Argv): Promise<number>;
|
|
14
|
+
export { run as runCli };
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AA8BH,KAAK,IAAI,GAAG,MAAM,EAAE,CAAC;AAcrB,iBAAe,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CA2E9C;AAgBD,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* armoriq — TypeScript CLI for the ArmorIQ SDK.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the PY CLI command surface from armoriq_sdk/cli.py and cli_auth.py.
|
|
7
|
+
* Supports: login, logout, whoami, orgs, switch-org, status, logs, keys.
|
|
8
|
+
*
|
|
9
|
+
* Note: `init`, `validate`, and `register` (which need MCP JSON-RPC discovery)
|
|
10
|
+
* are not yet implemented in TS — direct users to the PY CLI for those flows
|
|
11
|
+
* (or stay tuned for follow-up parity work).
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.runCli = run;
|
|
15
|
+
const util_1 = require("./util");
|
|
16
|
+
const HELP = `
|
|
17
|
+
armoriq — ArmorIQ SDK CLI
|
|
18
|
+
|
|
19
|
+
Usage: armoriq <command> [options]
|
|
20
|
+
|
|
21
|
+
Commands:
|
|
22
|
+
login [--org <name>] OAuth device-code login flow
|
|
23
|
+
logout Remove cached credentials
|
|
24
|
+
whoami Show the currently logged-in account
|
|
25
|
+
|
|
26
|
+
orgs List organizations you belong to
|
|
27
|
+
switch-org <name-or-id> Switch the active org and rotate API key
|
|
28
|
+
[--key-name <name>]
|
|
29
|
+
|
|
30
|
+
keys list List API keys for this account
|
|
31
|
+
keys revoke <id> Revoke a single API key
|
|
32
|
+
keys prune [--yes] Revoke expired / unused (>90d) keys
|
|
33
|
+
|
|
34
|
+
status Show local CLI state (agent, env, MCPs)
|
|
35
|
+
logs [--follow] Tail the CLI log file
|
|
36
|
+
|
|
37
|
+
help Show this help
|
|
38
|
+
|
|
39
|
+
Use \`armoriq help <command>\` for command-specific options.
|
|
40
|
+
`;
|
|
41
|
+
function parseFlag(args, name, hasValue = true) {
|
|
42
|
+
for (let i = 0; i < args.length; i++) {
|
|
43
|
+
if (args[i] === `--${name}`) {
|
|
44
|
+
if (!hasValue)
|
|
45
|
+
return true;
|
|
46
|
+
const v = args[i + 1];
|
|
47
|
+
args.splice(i, 2);
|
|
48
|
+
return v;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
async function run(argv) {
|
|
54
|
+
const [command, ...rest] = argv;
|
|
55
|
+
if (!command || command === 'help' || command === '--help' || command === '-h') {
|
|
56
|
+
(0, util_1.out)(HELP);
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
switch (command) {
|
|
60
|
+
case 'login': {
|
|
61
|
+
const { cmdLogin } = await import('./commands/auth.js');
|
|
62
|
+
const org = parseFlag(rest, 'org');
|
|
63
|
+
const backend = parseFlag(rest, 'backend');
|
|
64
|
+
return cmdLogin({ org, backend });
|
|
65
|
+
}
|
|
66
|
+
case 'logout': {
|
|
67
|
+
const { cmdLogout } = await import('./commands/auth.js');
|
|
68
|
+
return cmdLogout();
|
|
69
|
+
}
|
|
70
|
+
case 'whoami': {
|
|
71
|
+
const { cmdWhoami } = await import('./commands/auth.js');
|
|
72
|
+
return cmdWhoami();
|
|
73
|
+
}
|
|
74
|
+
case 'orgs': {
|
|
75
|
+
const { cmdOrgs } = await import('./commands/orgs.js');
|
|
76
|
+
return cmdOrgs();
|
|
77
|
+
}
|
|
78
|
+
case 'switch-org': {
|
|
79
|
+
const { cmdSwitchOrg } = await import('./commands/orgs.js');
|
|
80
|
+
const keyName = parseFlag(rest, 'key-name');
|
|
81
|
+
const target = rest.find((a) => !a.startsWith('--'));
|
|
82
|
+
if (!target)
|
|
83
|
+
throw new util_1.CLIError('Usage: armoriq switch-org <name-or-id>');
|
|
84
|
+
return cmdSwitchOrg({ org: target, keyName });
|
|
85
|
+
}
|
|
86
|
+
case 'keys': {
|
|
87
|
+
const sub = rest[0];
|
|
88
|
+
const { cmdKeysList, cmdKeysRevoke, cmdKeysPrune } = await import('./commands/keys.js');
|
|
89
|
+
if (sub === 'list')
|
|
90
|
+
return cmdKeysList();
|
|
91
|
+
if (sub === 'revoke') {
|
|
92
|
+
const id = rest[1];
|
|
93
|
+
if (!id)
|
|
94
|
+
throw new util_1.CLIError('Usage: armoriq keys revoke <id>');
|
|
95
|
+
return cmdKeysRevoke({ id });
|
|
96
|
+
}
|
|
97
|
+
if (sub === 'prune') {
|
|
98
|
+
const yes = Boolean(parseFlag(rest, 'yes', false));
|
|
99
|
+
return cmdKeysPrune({ yes });
|
|
100
|
+
}
|
|
101
|
+
(0, util_1.out)('Usage: armoriq keys list | revoke <id> | prune [--yes]');
|
|
102
|
+
return 1;
|
|
103
|
+
}
|
|
104
|
+
case 'status': {
|
|
105
|
+
const { cmdStatus } = await import('./commands/status.js');
|
|
106
|
+
return cmdStatus();
|
|
107
|
+
}
|
|
108
|
+
case 'logs': {
|
|
109
|
+
const { cmdLogs } = await import('./commands/status.js');
|
|
110
|
+
const follow = Boolean(parseFlag(rest, 'follow', false));
|
|
111
|
+
return cmdLogs({ follow });
|
|
112
|
+
}
|
|
113
|
+
case 'init':
|
|
114
|
+
case 'validate':
|
|
115
|
+
case 'register': {
|
|
116
|
+
(0, util_1.out)(`'armoriq ${command}' is not yet implemented in the TypeScript CLI.\n` +
|
|
117
|
+
'Use the Python CLI for now (`pip install armoriq-sdk` then `armoriq ' +
|
|
118
|
+
command +
|
|
119
|
+
'`), or follow this issue: https://github.com/armoriq/armoriq-sdk-customer-ts/issues/40');
|
|
120
|
+
return 1;
|
|
121
|
+
}
|
|
122
|
+
default:
|
|
123
|
+
(0, util_1.out)(`Unknown command: ${command}`);
|
|
124
|
+
(0, util_1.out)(HELP);
|
|
125
|
+
return 1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (require.main === module) {
|
|
129
|
+
const argv = process.argv.slice(2);
|
|
130
|
+
run(argv)
|
|
131
|
+
.then((code) => process.exit(code))
|
|
132
|
+
.catch((err) => {
|
|
133
|
+
if (err instanceof util_1.CLIError) {
|
|
134
|
+
(0, util_1.out)(` ${util_1.CROSS} ${err.message}`);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
(0, util_1.out)(` ${util_1.CROSS} Unexpected error: ${err.message}`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;GASG;;AAuIa,qBAAM;AArItB,iCAA8C;AAE9C,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBZ,CAAC;AAIF,SAAS,SAAS,CAAC,IAAU,EAAE,IAAY,EAAE,WAAoB,IAAI;IACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,EAAE,EAAE,CAAC;YAC5B,IAAI,CAAC,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,KAAK,UAAU,GAAG,CAAC,IAAU;IAC3B,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEhC,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC/E,IAAA,UAAG,EAAC,IAAI,CAAC,CAAC;QACV,OAAO,CAAC,CAAC;IACX,CAAC;IAED,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,EAAE,QAAQ,EAAE,GAAG,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C,CAAC,CAAC;YAChB,IAAA,UAAG,EACD,YAAY,OAAO,mDAAmD;gBACpE,sEAAsE;gBACtE,OAAO;gBACP,wFAAwF,CAC3F,CAAC;YACF,OAAO,CAAC,CAAC;QACX,CAAC;QACD;YACE,IAAA,UAAG,EAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;YACnC,IAAA,UAAG,EAAC,IAAI,CAAC,CAAC;YACV,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,GAAG,CAAC,IAAI,CAAC;SACN,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAClC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,IAAI,GAAG,YAAY,eAAQ,EAAE,CAAC;YAC5B,IAAA,UAAG,EAAC,KAAK,YAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,IAAA,UAAG,EAAC,KAAK,YAAK,sBAAuB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local CLI state ($HOME/.armoriq/{state,cli.log}.{json,jsonl}).
|
|
3
|
+
* Mirrors the layout used by armoriq_sdk/cli.py so PY and TS CLIs share the same files.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ARMORIQ_DIR: string;
|
|
6
|
+
export declare const STATE_FILE: string;
|
|
7
|
+
export declare const LOG_FILE: string;
|
|
8
|
+
export type CliState = {
|
|
9
|
+
registered_at?: string;
|
|
10
|
+
config_path?: string;
|
|
11
|
+
agent_id?: string;
|
|
12
|
+
user_id?: string;
|
|
13
|
+
environment?: string;
|
|
14
|
+
proxy_endpoint?: string;
|
|
15
|
+
mcp_servers?: string[];
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
export declare function loadState(): CliState;
|
|
19
|
+
export declare function saveState(state: CliState): void;
|
|
20
|
+
export declare function clearState(): boolean;
|
|
21
|
+
export declare function appendLog(event: string, details?: Record<string, unknown>): void;
|
|
22
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/cli/state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,eAAO,MAAM,WAAW,QAAsC,CAAC;AAC/D,eAAO,MAAM,UAAU,QAAuC,CAAC;AAC/D,eAAO,MAAM,QAAQ,QAAoC,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAAG;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,SAAS,IAAI,QAAQ,CAOpC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAG/C;AAED,wBAAgB,UAAU,IAAI,OAAO,CAUpC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI,CAYpF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Local CLI state ($HOME/.armoriq/{state,cli.log}.{json,jsonl}).
|
|
4
|
+
* Mirrors the layout used by armoriq_sdk/cli.py so PY and TS CLIs share the same files.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.LOG_FILE = exports.STATE_FILE = exports.ARMORIQ_DIR = void 0;
|
|
41
|
+
exports.loadState = loadState;
|
|
42
|
+
exports.saveState = saveState;
|
|
43
|
+
exports.clearState = clearState;
|
|
44
|
+
exports.appendLog = appendLog;
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const os = __importStar(require("os"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
exports.ARMORIQ_DIR = path.join(os.homedir(), '.armoriq');
|
|
49
|
+
exports.STATE_FILE = path.join(exports.ARMORIQ_DIR, 'state.json');
|
|
50
|
+
exports.LOG_FILE = path.join(exports.ARMORIQ_DIR, 'cli.log');
|
|
51
|
+
function loadState() {
|
|
52
|
+
try {
|
|
53
|
+
if (!fs.existsSync(exports.STATE_FILE))
|
|
54
|
+
return {};
|
|
55
|
+
return JSON.parse(fs.readFileSync(exports.STATE_FILE, 'utf-8'));
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function saveState(state) {
|
|
62
|
+
fs.mkdirSync(exports.ARMORIQ_DIR, { recursive: true });
|
|
63
|
+
fs.writeFileSync(exports.STATE_FILE, JSON.stringify(state, null, 2) + '\n', { mode: 0o600 });
|
|
64
|
+
}
|
|
65
|
+
function clearState() {
|
|
66
|
+
try {
|
|
67
|
+
if (fs.existsSync(exports.STATE_FILE)) {
|
|
68
|
+
fs.unlinkSync(exports.STATE_FILE);
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function appendLog(event, details = {}) {
|
|
78
|
+
try {
|
|
79
|
+
fs.mkdirSync(exports.ARMORIQ_DIR, { recursive: true });
|
|
80
|
+
const entry = JSON.stringify({
|
|
81
|
+
timestamp: new Date().toISOString(),
|
|
82
|
+
event,
|
|
83
|
+
details,
|
|
84
|
+
});
|
|
85
|
+
fs.appendFileSync(exports.LOG_FILE, entry + '\n');
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// best-effort; never throw on log write
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/cli/state.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBH,8BAOC;AAED,8BAGC;AAED,gCAUC;AAED,8BAYC;AAzDD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAEhB,QAAA,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AAClD,QAAA,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAW,EAAE,YAAY,CAAC,CAAC;AAClD,QAAA,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAW,EAAE,SAAS,CAAC,CAAC;AAa1D,SAAgB,SAAS;IACvB,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAU,CAAC;YAAE,OAAO,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,kBAAU,EAAE,OAAO,CAAC,CAAa,CAAC;IACtE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAgB,SAAS,CAAC,KAAe;IACvC,EAAE,CAAC,SAAS,CAAC,mBAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,EAAE,CAAC,aAAa,CAAC,kBAAU,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACvF,CAAC;AAED,SAAgB,UAAU;IACxB,IAAI,CAAC;QACH,IAAI,EAAE,CAAC,UAAU,CAAC,kBAAU,CAAC,EAAE,CAAC;YAC9B,EAAE,CAAC,UAAU,CAAC,kBAAU,CAAC,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAgB,SAAS,CAAC,KAAa,EAAE,UAAmC,EAAE;IAC5E,IAAI,CAAC;QACH,EAAE,CAAC,SAAS,CAAC,mBAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;YAC3B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,KAAK;YACL,OAAO;SACR,CAAC,CAAC;QACH,EAAE,CAAC,cAAc,CAAC,gBAAQ,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;IAC1C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI utilities: console formatting, prompts, env-driven endpoint
|
|
3
|
+
* resolution, and the "require credentials" guard.
|
|
4
|
+
*/
|
|
5
|
+
import { Credentials } from '../credentials';
|
|
6
|
+
export declare const CHECK = "\u001B[32m\u2714\u001B[0m";
|
|
7
|
+
export declare const CROSS = "\u001B[31m\u2718\u001B[0m";
|
|
8
|
+
export declare const WARN = "\u001B[33m!\u001B[0m";
|
|
9
|
+
export declare class CLIError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
export declare function out(message?: string): void;
|
|
13
|
+
export declare function maskSecret(secret: string): string;
|
|
14
|
+
export declare function prompt(question: string, defaultValue?: string): Promise<string>;
|
|
15
|
+
export declare function promptYesNo(question: string, defaultValue?: boolean): Promise<boolean>;
|
|
16
|
+
export declare function backendBase(): string;
|
|
17
|
+
export declare function proxyBase(): string;
|
|
18
|
+
export declare function requireCredentials(): Credentials;
|
|
19
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAuC,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlF,eAAO,MAAM,KAAK,8BAAqB,CAAC;AACxC,eAAO,MAAM,KAAK,8BAAqB,CAAC;AACxC,eAAO,MAAM,IAAI,yBAAqB,CAAC;AAEvC,qBAAa,QAAS,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAgB,GAAG,CAAC,OAAO,GAAE,MAAW,GAAG,IAAI,CAE9C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASrF;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAKnG;AAED,wBAAgB,WAAW,IAAI,MAAM,CAIpC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAIlC;AAED,wBAAgB,kBAAkB,IAAI,WAAW,CAQhD"}
|
package/dist/cli/util.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared CLI utilities: console formatting, prompts, env-driven endpoint
|
|
4
|
+
* resolution, and the "require credentials" guard.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.CLIError = exports.WARN = exports.CROSS = exports.CHECK = void 0;
|
|
41
|
+
exports.out = out;
|
|
42
|
+
exports.maskSecret = maskSecret;
|
|
43
|
+
exports.prompt = prompt;
|
|
44
|
+
exports.promptYesNo = promptYesNo;
|
|
45
|
+
exports.backendBase = backendBase;
|
|
46
|
+
exports.proxyBase = proxyBase;
|
|
47
|
+
exports.requireCredentials = requireCredentials;
|
|
48
|
+
const readline = __importStar(require("readline"));
|
|
49
|
+
const credentials_1 = require("../credentials");
|
|
50
|
+
const _build_env_1 = require("../_build_env");
|
|
51
|
+
exports.CHECK = '\x1b[32m✔\x1b[0m';
|
|
52
|
+
exports.CROSS = '\x1b[31m✘\x1b[0m';
|
|
53
|
+
exports.WARN = '\x1b[33m!\x1b[0m';
|
|
54
|
+
class CLIError extends Error {
|
|
55
|
+
constructor(message) {
|
|
56
|
+
super(message);
|
|
57
|
+
this.name = 'CLIError';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.CLIError = CLIError;
|
|
61
|
+
function out(message = '') {
|
|
62
|
+
process.stdout.write(message + '\n');
|
|
63
|
+
}
|
|
64
|
+
function maskSecret(secret) {
|
|
65
|
+
if (!secret)
|
|
66
|
+
return '';
|
|
67
|
+
if (secret.length <= 16)
|
|
68
|
+
return secret;
|
|
69
|
+
return secret.slice(0, 16) + '...';
|
|
70
|
+
}
|
|
71
|
+
async function prompt(question, defaultValue) {
|
|
72
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
73
|
+
const suffix = defaultValue ? ` [${defaultValue}]` : '';
|
|
74
|
+
return new Promise((resolve) => {
|
|
75
|
+
rl.question(`${question}${suffix}: `, (answer) => {
|
|
76
|
+
rl.close();
|
|
77
|
+
resolve(answer.trim() || defaultValue || '');
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async function promptYesNo(question, defaultValue = false) {
|
|
82
|
+
const hint = defaultValue ? 'Y/n' : 'y/N';
|
|
83
|
+
const answer = (await prompt(`${question} [${hint}]`)).toLowerCase();
|
|
84
|
+
if (!answer)
|
|
85
|
+
return defaultValue;
|
|
86
|
+
return answer === 'y' || answer === 'yes';
|
|
87
|
+
}
|
|
88
|
+
function backendBase() {
|
|
89
|
+
const explicit = process.env.BACKEND_ENDPOINT || process.env.ARMORIQ_BACKEND_URL;
|
|
90
|
+
if (explicit)
|
|
91
|
+
return explicit.replace(/\/+$/, '');
|
|
92
|
+
return (0, _build_env_1.resolveEndpoint)('backend').replace(/\/+$/, '');
|
|
93
|
+
}
|
|
94
|
+
function proxyBase() {
|
|
95
|
+
const explicit = process.env.PROXY_ENDPOINT;
|
|
96
|
+
if (explicit)
|
|
97
|
+
return explicit.replace(/\/+$/, '');
|
|
98
|
+
return (0, _build_env_1.resolveEndpoint)('proxy').replace(/\/+$/, '');
|
|
99
|
+
}
|
|
100
|
+
function requireCredentials() {
|
|
101
|
+
const creds = (0, credentials_1.loadCredentials)();
|
|
102
|
+
if (!creds) {
|
|
103
|
+
throw new CLIError(`Not logged in (${(0, credentials_1.getCredentialsPath)()} missing). Run \`armoriq login\` first.`);
|
|
104
|
+
}
|
|
105
|
+
return creds;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBH,kBAEC;AAED,gCAIC;AAED,wBASC;AAED,kCAKC;AAED,kCAIC;AAED,8BAIC;AAED,gDAQC;AA/DD,mDAAqC;AACrC,gDAAkF;AAClF,8CAAgD;AAEnC,QAAA,KAAK,GAAG,kBAAkB,CAAC;AAC3B,QAAA,KAAK,GAAG,kBAAkB,CAAC;AAC3B,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAEvC,MAAa,QAAS,SAAQ,KAAK;IACjC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AALD,4B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,IAAI,CAAC,MAAM;QAAE,OAAO,YAAY,CAAC;IACjC,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,CAAC;AAC5C,CAAC;AAED,SAAgB,WAAW;IACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IACjF,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClD,OAAO,IAAA,4BAAe,EAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,SAAgB,SAAS;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC5C,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClD,OAAO,IAAA,4BAAe,EAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,kBAAkB;IAChC,MAAM,KAAK,GAAG,IAAA,6BAAe,GAAE,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,QAAQ,CAChB,kBAAkB,IAAA,gCAAkB,GAAE,yCAAyC,CAChF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ArmorIQ SDK Client - Main entry point for SDK usage.
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { IntentToken, PlanCapture, MCPInvocationResult, DelegationResult, SDKConfig, MCPSemanticMetadata, InvokeOptions, DelegationRequestParams, DelegationRequestResult, ApprovedDelegation, McpCredential, McpCredentialMap } from './models';
|
|
5
6
|
export declare class ArmorIQClient {
|
|
6
7
|
private static readonly DEFAULT_IAP_ENDPOINT;
|
|
7
8
|
private static readonly DEFAULT_PROXY_ENDPOINT;
|
|
@@ -21,10 +22,20 @@ export declare class ArmorIQClient {
|
|
|
21
22
|
private contextId;
|
|
22
23
|
private apiKey;
|
|
23
24
|
private timeout;
|
|
25
|
+
private maxRetries;
|
|
24
26
|
private verifySsl;
|
|
25
27
|
private httpClient;
|
|
26
28
|
private tokenCache;
|
|
27
29
|
private metadataCache;
|
|
30
|
+
private mcpCredentials;
|
|
31
|
+
private bootstrapCache;
|
|
32
|
+
private userCache;
|
|
33
|
+
private userContextTtlSeconds;
|
|
34
|
+
/**
|
|
35
|
+
* When set by ArmorIQUserScope, all enforcement / token minting calls
|
|
36
|
+
* are tagged with this email. Read by session and report paths.
|
|
37
|
+
*/
|
|
38
|
+
userEmailOverride?: string;
|
|
28
39
|
constructor(options?: Partial<SDKConfig> & {
|
|
29
40
|
apiKey?: string;
|
|
30
41
|
useProduction?: boolean;
|
|
@@ -33,6 +44,47 @@ export declare class ArmorIQClient {
|
|
|
33
44
|
* Get the default proxy endpoint URL.
|
|
34
45
|
*/
|
|
35
46
|
get proxyEndpoint(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Internal accessor for ArmorIQSession and other in-package consumers.
|
|
49
|
+
* Not part of the public API.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
_sessionInternals(): {
|
|
53
|
+
apiKey: string;
|
|
54
|
+
backendEndpoint: string;
|
|
55
|
+
defaultProxyEndpoint: string;
|
|
56
|
+
httpClient: axios.AxiosInstance;
|
|
57
|
+
userId: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Start a session bound to this client. Mirrors PY ArmorIQClient.start_session.
|
|
61
|
+
*/
|
|
62
|
+
startSession(opts?: import('./session').SessionOptions): import('./session').ArmorIQSession;
|
|
63
|
+
bootstrap(): Promise<Record<string, any>>;
|
|
64
|
+
refreshBootstrap(): Promise<Record<string, any>>;
|
|
65
|
+
resolveUser(userEmail: string): Promise<Record<string, any>>;
|
|
66
|
+
invalidateUser(userEmail: string): void;
|
|
67
|
+
forUser(userEmail: string): ArmorIQUserScope;
|
|
68
|
+
/**
|
|
69
|
+
* Construct an ArmorIQClient from an armoriq.yaml file. Mirrors PY
|
|
70
|
+
* ArmorIQClient.from_config — reads YAML, expands $VAR / ${VAR} env refs,
|
|
71
|
+
* builds the SDKConfig, and returns a ready client.
|
|
72
|
+
*/
|
|
73
|
+
static fromConfig(filePath?: string): ArmorIQClient;
|
|
74
|
+
static resolveMcpCredentials(fromOptions?: McpCredentialMap): McpCredentialMap;
|
|
75
|
+
private getMcpCredential;
|
|
76
|
+
static encodeMcpAuthHeader(cred: McpCredential): string;
|
|
77
|
+
private shouldRetry;
|
|
78
|
+
/**
|
|
79
|
+
* POST with exponential backoff. Reuses the same Idempotency-Key
|
|
80
|
+
* across retries so the backend can dedupe on its side.
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
_retryPost(url: string, body: unknown, options?: {
|
|
84
|
+
headers?: Record<string, string>;
|
|
85
|
+
timeout?: number;
|
|
86
|
+
idempotencyKey?: string;
|
|
87
|
+
}): Promise<import('axios').AxiosResponse>;
|
|
36
88
|
/**
|
|
37
89
|
* Validate API key with the proxy server.
|
|
38
90
|
*/
|
|
@@ -99,6 +151,9 @@ export declare class ArmorIQClient {
|
|
|
99
151
|
checkApprovedDelegation(userEmail: string, tool: string, amount: number): Promise<ApprovedDelegation | null>;
|
|
100
152
|
/**
|
|
101
153
|
* Mark a delegation as executed.
|
|
154
|
+
*
|
|
155
|
+
* Idempotent on the backend (delegationId-keyed), so a stable
|
|
156
|
+
* Idempotency-Key derived from the delegation_id is safe to retry.
|
|
102
157
|
*/
|
|
103
158
|
markDelegationExecuted(userEmail: string, delegationId: string): Promise<void>;
|
|
104
159
|
/**
|
|
@@ -107,6 +162,9 @@ export declare class ArmorIQClient {
|
|
|
107
162
|
completePlan(planId: string): Promise<void>;
|
|
108
163
|
/**
|
|
109
164
|
* Update an intent plan's status.
|
|
165
|
+
*
|
|
166
|
+
* Status transitions are idempotent — retrying with the same
|
|
167
|
+
* `planId:status` key is safe.
|
|
110
168
|
* Valid statuses: 'active', 'completed', 'failed', 'expired'
|
|
111
169
|
*/
|
|
112
170
|
updatePlanStatus(planId: string, status: string): Promise<void>;
|
|
@@ -119,4 +177,18 @@ export declare class ArmorIQClient {
|
|
|
119
177
|
*/
|
|
120
178
|
close(): void;
|
|
121
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* User-scoped helper returned by ArmorIQClient.forUser(email).
|
|
182
|
+
*
|
|
183
|
+
* Mirrors armoriq_sdk/client.py:ArmorIQUserScope. Tags all token-minting
|
|
184
|
+
* and enforcement calls with the bound email so multi-user agents route
|
|
185
|
+
* per-request policies correctly.
|
|
186
|
+
*/
|
|
187
|
+
export declare class ArmorIQUserScope {
|
|
188
|
+
private client;
|
|
189
|
+
readonly userEmail: string;
|
|
190
|
+
constructor(client: ArmorIQClient, userEmail: string);
|
|
191
|
+
startSession(opts?: import('./session').SessionOptions): import('./session').ArmorIQSession;
|
|
192
|
+
resolve(): Promise<Record<string, any>>;
|
|
193
|
+
}
|
|
122
194
|
//# sourceMappingURL=client.d.ts.map
|