@skrr-ai/cli 0.1.46 → 0.1.48
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 +1 -1
- package/dist/base-command.d.ts +18 -0
- package/dist/base-command.js +61 -1
- package/dist/commands/agents/chat.d.ts +21 -0
- package/dist/commands/agents/chat.js +26 -9
- package/dist/commands/balance/usage/breakdown.d.ts +14 -0
- package/dist/commands/balance/usage/breakdown.js +68 -0
- package/dist/commands/balance/usage.js +24 -0
- package/dist/commands/code/handover.d.ts +2 -2
- package/dist/commands/code/handover.js +12 -13
- package/dist/commands/code/install.js +31 -0
- package/dist/commands/code/update.d.ts +46 -0
- package/dist/commands/code/update.js +242 -0
- package/dist/commands/commerce/entitlements/explain.d.ts +22 -0
- package/dist/commands/commerce/entitlements/explain.js +40 -0
- package/dist/commands/commerce/incidents/audit.d.ts +20 -0
- package/dist/commands/commerce/incidents/audit.js +37 -0
- package/dist/commands/commerce/incidents/list.d.ts +22 -0
- package/dist/commands/commerce/incidents/list.js +49 -0
- package/dist/commands/commerce/incidents/resolve.d.ts +23 -0
- package/dist/commands/commerce/incidents/resolve.js +45 -0
- package/dist/commands/commerce/incidents/retry.d.ts +22 -0
- package/dist/commands/commerce/incidents/retry.js +45 -0
- package/dist/commands/commerce/incidents/show.d.ts +13 -0
- package/dist/commands/commerce/incidents/show.js +30 -0
- package/dist/commands/commerce/offers/approve.d.ts +17 -0
- package/dist/commands/commerce/offers/approve.js +33 -0
- package/dist/commands/commerce/offers/create.d.ts +18 -0
- package/dist/commands/commerce/offers/create.js +34 -0
- package/dist/commands/commerce/offers/publish.d.ts +13 -0
- package/dist/commands/commerce/offers/publish.js +28 -0
- package/dist/commands/commerce/offers/retire.d.ts +17 -0
- package/dist/commands/commerce/offers/retire.js +32 -0
- package/dist/commands/commerce/offers/validate.d.ts +18 -0
- package/dist/commands/commerce/offers/validate.js +33 -0
- package/dist/commands/commerce/products/create.d.ts +10 -0
- package/dist/commands/commerce/products/create.js +25 -0
- package/dist/commands/commerce/promotions/redeem.d.ts +13 -0
- package/dist/commands/commerce/promotions/redeem.js +32 -0
- package/dist/commands/commerce/terms/accept.d.ts +18 -0
- package/dist/commands/commerce/terms/accept.js +39 -0
- package/dist/commands/commerce/terms/show.d.ts +10 -0
- package/dist/commands/commerce/terms/show.js +34 -0
- package/dist/commands/commerce/trials/conversion-preview.d.ts +18 -0
- package/dist/commands/commerce/trials/conversion-preview.js +39 -0
- package/dist/commands/commerce/trials/start.d.ts +23 -0
- package/dist/commands/commerce/trials/start.js +58 -0
- package/dist/commands/commitments/accounting.d.ts +39 -0
- package/dist/commands/commitments/accounting.js +116 -0
- package/dist/commands/commitments/action-history.d.ts +1 -0
- package/dist/commands/commitments/action-history.js +8 -1
- package/dist/commands/commitments/case.d.ts +1 -0
- package/dist/commands/commitments/case.js +19 -3
- package/dist/commands/commitments/cases.d.ts +1 -0
- package/dist/commands/commitments/cases.js +11 -1
- package/dist/commands/commitments/checks.d.ts +1 -0
- package/dist/commands/commitments/checks.js +5 -1
- package/dist/commands/commitments/cost.d.ts +62 -0
- package/dist/commands/commitments/cost.js +130 -0
- package/dist/commands/commitments/create.js +1 -1
- package/dist/commands/commitments/delete.d.ts +1 -0
- package/dist/commands/commitments/delete.js +56 -6
- package/dist/commands/commitments/feedback.js +9 -1
- package/dist/commands/commitments/handover.js +16 -0
- package/dist/commands/commitments/hypotheses.d.ts +1 -0
- package/dist/commands/commitments/hypotheses.js +17 -2
- package/dist/commands/commitments/links/list.js +4 -1
- package/dist/commands/commitments/liveness.d.ts +18 -0
- package/dist/commands/commitments/liveness.js +80 -0
- package/dist/commands/commitments/metrics.d.ts +1 -0
- package/dist/commands/commitments/metrics.js +8 -1
- package/dist/commands/commitments/next-tick.d.ts +39 -0
- package/dist/commands/commitments/next-tick.js +122 -0
- package/dist/commands/commitments/observations.d.ts +1 -0
- package/dist/commands/commitments/observations.js +19 -2
- package/dist/commands/commitments/pause.js +12 -0
- package/dist/commands/commitments/receipt.d.ts +2 -0
- package/dist/commands/commitments/receipt.js +16 -2
- package/dist/commands/commitments/remediation-proposal.js +6 -2
- package/dist/commands/commitments/remediation-proposals.js +5 -1
- package/dist/commands/commitments/restore.d.ts +25 -0
- package/dist/commands/commitments/restore.js +46 -0
- package/dist/commands/commitments/show.js +32 -0
- package/dist/commands/commitments/trigger-status.js +33 -0
- package/dist/commands/commitments/update.d.ts +1 -0
- package/dist/commands/commitments/update.js +31 -5
- package/dist/commands/commitments/wake-capabilities.d.ts +0 -1
- package/dist/commands/commitments/wake-capabilities.js +8 -4
- package/dist/commands/convos/handover.d.ts +1 -0
- package/dist/commands/convos/handover.js +4 -0
- package/dist/commands/daemon/index.js +2 -0
- package/dist/commands/daemon/update.d.ts +19 -0
- package/dist/commands/daemon/update.js +48 -0
- package/dist/commands/enterprise/budgets/create.d.ts +11 -0
- package/dist/commands/enterprise/budgets/create.js +27 -0
- package/dist/commands/enterprise/budgets/evaluate.d.ts +17 -0
- package/dist/commands/enterprise/budgets/evaluate.js +32 -0
- package/dist/commands/enterprise/budgets/publish.d.ts +14 -0
- package/dist/commands/enterprise/budgets/publish.js +30 -0
- package/dist/commands/enterprise/contracts/activate.d.ts +14 -0
- package/dist/commands/enterprise/contracts/activate.js +30 -0
- package/dist/commands/enterprise/contracts/create.d.ts +14 -0
- package/dist/commands/enterprise/contracts/create.js +32 -0
- package/dist/commands/enterprise/contracts/issue.d.ts +18 -0
- package/dist/commands/enterprise/contracts/issue.js +34 -0
- package/dist/commands/enterprise/domains/begin.d.ts +20 -0
- package/dist/commands/enterprise/domains/begin.js +39 -0
- package/dist/commands/enterprise/domains/verify.d.ts +14 -0
- package/dist/commands/enterprise/domains/verify.js +32 -0
- package/dist/commands/enterprise/external-config/activate.d.ts +22 -0
- package/dist/commands/enterprise/external-config/activate.js +49 -0
- package/dist/commands/enterprise/external-config/set.d.ts +25 -0
- package/dist/commands/enterprise/external-config/set.js +123 -0
- package/dist/commands/enterprise/external-config/show.d.ts +12 -0
- package/dist/commands/enterprise/external-config/show.js +39 -0
- package/dist/commands/enterprise/external-config/suspend.d.ts +13 -0
- package/dist/commands/enterprise/external-config/suspend.js +41 -0
- package/dist/commands/enterprise/finance/close-snapshot.d.ts +11 -0
- package/dist/commands/enterprise/finance/close-snapshot.js +28 -0
- package/dist/commands/enterprise/finance/record-document.d.ts +18 -0
- package/dist/commands/enterprise/finance/record-document.js +35 -0
- package/dist/commands/enterprise/profile.d.ts +20 -0
- package/dist/commands/enterprise/profile.js +38 -0
- package/dist/commands/login.d.ts +13 -0
- package/dist/commands/login.js +77 -0
- package/dist/commands/machines/dedicated/index.js +3 -0
- package/dist/commands/machines/dedicated/service/apply.d.ts +23 -0
- package/dist/commands/machines/dedicated/service/apply.js +99 -0
- package/dist/commands/machines/dedicated/service/approve.d.ts +23 -0
- package/dist/commands/machines/dedicated/service/approve.js +52 -0
- package/dist/commands/machines/dedicated/service/create.d.ts +55 -0
- package/dist/commands/machines/dedicated/service/create.js +222 -0
- package/dist/commands/machines/dedicated/service/edit.d.ts +30 -0
- package/dist/commands/machines/dedicated/service/edit.js +146 -0
- package/dist/commands/machines/dedicated/service/exec.d.ts +26 -0
- package/dist/commands/machines/dedicated/service/exec.js +92 -0
- package/dist/commands/machines/dedicated/service/export.d.ts +29 -0
- package/dist/commands/machines/dedicated/service/export.js +106 -0
- package/dist/commands/machines/dedicated/service/index.d.ts +14 -0
- package/dist/commands/machines/dedicated/service/index.js +49 -0
- package/dist/commands/machines/dedicated/service/logs.d.ts +33 -0
- package/dist/commands/machines/dedicated/service/logs.js +148 -0
- package/dist/commands/machines/dedicated/service/ls.d.ts +20 -0
- package/dist/commands/machines/dedicated/service/ls.js +80 -0
- package/dist/commands/machines/dedicated/service/restart.d.ts +14 -0
- package/dist/commands/machines/dedicated/service/restart.js +29 -0
- package/dist/commands/machines/dedicated/service/rm.d.ts +20 -0
- package/dist/commands/machines/dedicated/service/rm.js +33 -0
- package/dist/commands/machines/dedicated/service/secret/index.d.ts +14 -0
- package/dist/commands/machines/dedicated/service/secret/index.js +25 -0
- package/dist/commands/machines/dedicated/service/secret/rm.d.ts +22 -0
- package/dist/commands/machines/dedicated/service/secret/rm.js +54 -0
- package/dist/commands/machines/dedicated/service/secret/set.d.ts +22 -0
- package/dist/commands/machines/dedicated/service/secret/set.js +93 -0
- package/dist/commands/machines/dedicated/service/start.d.ts +14 -0
- package/dist/commands/machines/dedicated/service/start.js +29 -0
- package/dist/commands/machines/dedicated/service/status.d.ts +21 -0
- package/dist/commands/machines/dedicated/service/status.js +85 -0
- package/dist/commands/machines/dedicated/service/stop.d.ts +20 -0
- package/dist/commands/machines/dedicated/service/stop.js +35 -0
- package/dist/commands/machines/dedicated/service/top.d.ts +22 -0
- package/dist/commands/machines/dedicated/service/top.js +120 -0
- package/dist/commands/machines/dedicated/sign-in-status.d.ts +22 -0
- package/dist/commands/machines/dedicated/sign-in-status.js +79 -0
- package/dist/commands/machines/dedicated/ssh-config.d.ts +28 -0
- package/dist/commands/machines/dedicated/ssh-config.js +66 -0
- package/dist/commands/machines/dedicated/ssh-proxy.d.ts +22 -0
- package/dist/commands/machines/dedicated/ssh-proxy.js +62 -0
- package/dist/commands/machines/dedicated/ssh.d.ts +29 -0
- package/dist/commands/machines/dedicated/ssh.js +121 -0
- package/dist/commands/native/allow-all.d.ts +14 -0
- package/dist/commands/native/allow-all.js +25 -0
- package/dist/commands/native/allow.d.ts +24 -0
- package/dist/commands/native/allow.js +45 -0
- package/dist/commands/native/deny.d.ts +24 -0
- package/dist/commands/native/deny.js +43 -0
- package/dist/commands/native/disable.d.ts +17 -0
- package/dist/commands/native/disable.js +28 -0
- package/dist/commands/native/enable.d.ts +12 -0
- package/dist/commands/native/enable.js +29 -0
- package/dist/commands/native/list-apps.d.ts +19 -0
- package/dist/commands/native/list-apps.js +30 -0
- package/dist/commands/native/restrict-to.d.ts +22 -0
- package/dist/commands/native/restrict-to.js +41 -0
- package/dist/commands/native/status.d.ts +19 -0
- package/dist/commands/native/status.js +33 -0
- package/dist/commands/native.d.ts +39 -0
- package/dist/commands/native.js +76 -0
- package/dist/commands/service/index.d.ts +14 -0
- package/dist/commands/service/index.js +31 -0
- package/dist/commands/service/logs.d.ts +18 -0
- package/dist/commands/service/logs.js +53 -0
- package/dist/commands/service/ls.d.ts +13 -0
- package/dist/commands/service/ls.js +48 -0
- package/dist/commands/service/propose.d.ts +34 -0
- package/dist/commands/service/propose.js +113 -0
- package/dist/commands/service/status.d.ts +17 -0
- package/dist/commands/service/status.js +56 -0
- package/dist/commands/spaces/auto-executor/runs.d.ts +13 -0
- package/dist/commands/spaces/auto-executor/runs.js +56 -0
- package/dist/commands/spaces/briefs/get.js +8 -0
- package/dist/commands/spaces/briefs/list.js +2 -0
- package/dist/commands/spaces/briefs/set.d.ts +3 -0
- package/dist/commands/spaces/briefs/set.js +78 -13
- package/dist/commands/spaces/expertise-suggestions.d.ts +12 -0
- package/dist/commands/spaces/expertise-suggestions.js +71 -0
- package/dist/commands/spaces/members/add.d.ts +1 -0
- package/dist/commands/spaces/members/add.js +11 -3
- package/dist/commands/spaces/members/list.js +11 -0
- package/dist/commands/store/governance/artifacts.d.ts +25 -0
- package/dist/commands/store/governance/artifacts.js +55 -0
- package/dist/commands/store/governance/assign.d.ts +16 -0
- package/dist/commands/store/governance/assign.js +54 -0
- package/dist/commands/store/governance/create-license.d.ts +18 -0
- package/dist/commands/store/governance/create-license.js +35 -0
- package/dist/commands/store/governance/install-plan.d.ts +25 -0
- package/dist/commands/store/governance/install-plan.js +56 -0
- package/dist/commands/store/governance/license-policy.d.ts +30 -0
- package/dist/commands/store/governance/license-policy.js +69 -0
- package/dist/commands/store/governance/policy.d.ts +25 -0
- package/dist/commands/store/governance/policy.js +65 -0
- package/dist/commands/store/governance/publish-release.d.ts +17 -0
- package/dist/commands/store/governance/publish-release.js +34 -0
- package/dist/commands/tasks/assign.d.ts +9 -0
- package/dist/commands/tasks/assign.js +108 -1
- package/dist/commands/tasks/deliverable/add.d.ts +15 -0
- package/dist/commands/tasks/deliverable/add.js +174 -0
- package/dist/commands/tasks/deliverable/archive.d.ts +35 -0
- package/dist/commands/tasks/deliverable/archive.js +205 -0
- package/dist/commands/tasks/labels/detach.js +3 -0
- package/dist/commands/tasks/labels/suggest.d.ts +24 -0
- package/dist/commands/tasks/labels/suggest.js +69 -0
- package/dist/commands/tasks/list.d.ts +16 -2
- package/dist/commands/tasks/list.js +100 -24
- package/dist/commands/tasks/show.d.ts +23 -0
- package/dist/commands/tasks/show.js +51 -1
- package/dist/commands/wiki/rm.d.ts +22 -1
- package/dist/commands/wiki/rm.js +52 -3
- package/dist/lib/agentic-stream.js +10 -2
- package/dist/lib/assignee-resolver.d.ts +22 -0
- package/dist/lib/assignee-resolver.js +26 -0
- package/dist/lib/balance.d.ts +6 -1
- package/dist/lib/balance.js +15 -0
- package/dist/lib/code-handover.d.ts +0 -10
- package/dist/lib/code-handover.js +20 -5
- package/dist/lib/commerce-command.d.ts +48 -0
- package/dist/lib/commerce-command.js +70 -0
- package/dist/lib/commerce.d.ts +93 -0
- package/dist/lib/commerce.js +129 -0
- package/dist/lib/commitment-product.js +1 -1
- package/dist/lib/commitments.d.ts +202 -29
- package/dist/lib/commitments.js +300 -33
- package/dist/lib/dedicated-lease-command.js +10 -0
- package/dist/lib/dedicated-machines.d.ts +37 -0
- package/dist/lib/dedicated-machines.js +47 -0
- package/dist/lib/dedicated-service-command.d.ts +60 -0
- package/dist/lib/dedicated-service-command.js +182 -0
- package/dist/lib/dedicated-service.d.ts +342 -0
- package/dist/lib/dedicated-service.js +741 -0
- package/dist/lib/dedicated-ssh.d.ts +136 -0
- package/dist/lib/dedicated-ssh.js +387 -0
- package/dist/lib/delegated-cli.js +51 -13
- package/dist/lib/enterprise-commerce.d.ts +67 -0
- package/dist/lib/enterprise-commerce.js +112 -0
- package/dist/lib/enterprise-external-configuration.d.ts +60 -0
- package/dist/lib/enterprise-external-configuration.js +58 -0
- package/dist/lib/first-party-harness.js +17 -3
- package/dist/lib/governed-store.d.ts +110 -0
- package/dist/lib/governed-store.js +79 -0
- package/dist/lib/guest-service-command.d.ts +16 -0
- package/dist/lib/guest-service-command.js +32 -0
- package/dist/lib/guest-service.d.ts +67 -0
- package/dist/lib/guest-service.js +112 -0
- package/dist/lib/prompt.d.ts +1 -0
- package/dist/lib/prompt.js +1 -0
- package/dist/lib/task-asset-upload.d.ts +20 -0
- package/dist/lib/task-asset-upload.js +30 -8
- package/dist/lib/task-extras.d.ts +23 -0
- package/dist/lib/task-extras.js +6 -0
- package/dist/lib/update-check.d.ts +80 -7
- package/dist/lib/update-check.js +365 -33
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonScopes.d.ts +9 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonScopes.js +10 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.d.ts +9 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +6 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.d.ts +16 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.js +21 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +24 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonScopes.d.ts +9 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonScopes.js +10 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.d.ts +9 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.d.ts +16 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.js +20 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +24 -2
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +5067 -4821
- package/oclif.manifest.json +34877 -28659
- package/package.json +43 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GUEST_SERVICE_CALL_TIMEOUT_MS = void 0;
|
|
4
|
+
exports.callGuestServiceSocket = callGuestServiceSocket;
|
|
5
|
+
exports.proposeGuestService = proposeGuestService;
|
|
6
|
+
exports.callGuestServiceRead = callGuestServiceRead;
|
|
7
|
+
exports.readGuestSpecFile = readGuestSpecFile;
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_net_1 = require("node:net");
|
|
10
|
+
const dedicated_service_1 = require("./dedicated-service");
|
|
11
|
+
exports.GUEST_SERVICE_CALL_TIMEOUT_MS = 15_000;
|
|
12
|
+
/**
|
|
13
|
+
* Write one document to the propose socket and read the daemon's one reply.
|
|
14
|
+
* Half-closing after the write is the "request is complete" signal — a
|
|
15
|
+
* keep-alive protocol would need framing the design does not specify.
|
|
16
|
+
*/
|
|
17
|
+
function callGuestServiceSocket(document, options = {}) {
|
|
18
|
+
const socketPath = options.socketPath ?? dedicated_service_1.GUEST_SERVICE_SOCKET_PATH;
|
|
19
|
+
const connect = options.connect ?? node_net_1.connect;
|
|
20
|
+
const timeoutMs = options.timeoutMs ?? exports.GUEST_SERVICE_CALL_TIMEOUT_MS;
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
const socket = connect(socketPath);
|
|
23
|
+
const chunks = [];
|
|
24
|
+
let done = false;
|
|
25
|
+
const fail = (error) => {
|
|
26
|
+
if (done)
|
|
27
|
+
return;
|
|
28
|
+
done = true;
|
|
29
|
+
socket.destroy();
|
|
30
|
+
reject(error);
|
|
31
|
+
};
|
|
32
|
+
const timer = setTimeout(() => {
|
|
33
|
+
fail(new dedicated_service_1.DedicatedServiceError('The machine’s daemon did not answer the service socket in time.', 'GUEST_SERVICE_TIMEOUT'));
|
|
34
|
+
}, timeoutMs);
|
|
35
|
+
socket.on('connect', () => {
|
|
36
|
+
socket.write(`${JSON.stringify(document)}\n`, () => {
|
|
37
|
+
socket.end();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
socket.on('data', (chunk) => chunks.push(chunk));
|
|
41
|
+
socket.on('error', (err) => {
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
if (err.code === 'ENOENT' || err.code === 'ECONNREFUSED') {
|
|
44
|
+
fail(new dedicated_service_1.DedicatedServiceError(`The service socket (${socketPath}) is not there — this machine's daemon does not offer the service lane. ` +
|
|
45
|
+
'An agent should ask the owner to run `skrr machines dedicated service …` instead.', 'GUEST_SERVICE_UNAVAILABLE'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
fail(new dedicated_service_1.DedicatedServiceError(`The service socket refused the connection: ${err.message}`, 'GUEST_SERVICE_SOCKET'));
|
|
49
|
+
});
|
|
50
|
+
socket.on('close', () => {
|
|
51
|
+
if (done)
|
|
52
|
+
return;
|
|
53
|
+
done = true;
|
|
54
|
+
clearTimeout(timer);
|
|
55
|
+
const text = Buffer.concat(chunks).toString('utf8').trim();
|
|
56
|
+
if (!text) {
|
|
57
|
+
reject(new dedicated_service_1.DedicatedServiceError('The daemon closed the service socket without an answer.', 'GUEST_SERVICE_EMPTY'));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
let reply;
|
|
61
|
+
try {
|
|
62
|
+
reply = JSON.parse(text);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
reject(new dedicated_service_1.DedicatedServiceError(`The daemon answered with something that is not JSON: ${text.slice(0, 200)}`, 'GUEST_SERVICE_REPLY'));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!reply.ok) {
|
|
69
|
+
reject(new dedicated_service_1.DedicatedServiceError(reply.error || 'The daemon refused the service request.', reply.code || 'GUEST_SERVICE_REFUSED'));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
resolve(reply);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/** `skrr service propose` — hand the daemon a spec, get back a proposal id. */
|
|
77
|
+
async function proposeGuestService(spec, options = {}) {
|
|
78
|
+
const reply = await callGuestServiceSocket({ verb: 'propose', spec: (0, dedicated_service_1.specPayload)(spec) }, options);
|
|
79
|
+
// The daemon's pending proposal is keyed by the service name — that IS
|
|
80
|
+
// the id the owner approves with.
|
|
81
|
+
const proposalId = typeof reply.proposalId === 'string'
|
|
82
|
+
? reply.proposalId
|
|
83
|
+
: typeof reply.name === 'string'
|
|
84
|
+
? reply.name
|
|
85
|
+
: typeof reply.result?.proposalId === 'string'
|
|
86
|
+
? reply.result.proposalId
|
|
87
|
+
: '';
|
|
88
|
+
return { proposalId, reply };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* `skrr service ls|status|logs` — the read verbs on the same socket. The
|
|
92
|
+
* daemon returns `result` in whatever shape the verb defines; the commands
|
|
93
|
+
* render it, they do not reinterpret it.
|
|
94
|
+
*/
|
|
95
|
+
async function callGuestServiceRead(op, args = {}, options = {}) {
|
|
96
|
+
return callGuestServiceSocket({
|
|
97
|
+
verb: op,
|
|
98
|
+
...(args.name ? { name: args.name } : {}),
|
|
99
|
+
...(args.tailBytes !== undefined ? { tailBytes: args.tailBytes } : {}),
|
|
100
|
+
}, options);
|
|
101
|
+
}
|
|
102
|
+
/** Parse and validate a spec document read from a file the guest hands the daemon. */
|
|
103
|
+
function readGuestSpecFile(filePath) {
|
|
104
|
+
let raw;
|
|
105
|
+
try {
|
|
106
|
+
raw = (0, node_fs_1.readFileSync)(filePath, 'utf8');
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
throw new dedicated_service_1.DedicatedServiceError(`Cannot read ${filePath}: ${err instanceof Error ? err.message : err}`, 'SPEC_FILE');
|
|
110
|
+
}
|
|
111
|
+
return (0, dedicated_service_1.parseServiceSpecDocument)(raw, filePath);
|
|
112
|
+
}
|
package/dist/lib/prompt.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export declare function confirmDestructive(question: string, yesFlag: boolean, f
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function readJsonValue(source: string | undefined): Promise<unknown>;
|
|
49
49
|
export declare function readJsonBody(source: string | undefined): Promise<Record<string, unknown>>;
|
|
50
|
+
export declare function readStdin(): Promise<string>;
|
|
50
51
|
/**
|
|
51
52
|
* Copy every defined property from `overrides` onto `base` and return the
|
|
52
53
|
* result. `undefined` values are skipped so unset oclif flags don't clobber
|
package/dist/lib/prompt.js
CHANGED
|
@@ -38,6 +38,7 @@ exports.confirm = confirm;
|
|
|
38
38
|
exports.confirmDestructive = confirmDestructive;
|
|
39
39
|
exports.readJsonValue = readJsonValue;
|
|
40
40
|
exports.readJsonBody = readJsonBody;
|
|
41
|
+
exports.readStdin = readStdin;
|
|
41
42
|
exports.mergeDefined = mergeDefined;
|
|
42
43
|
const fs = __importStar(require("node:fs"));
|
|
43
44
|
const readline = __importStar(require("node:readline"));
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
export type TaskAssetRole = 'input' | 'evidence' | 'deliverable';
|
|
2
|
+
/**
|
|
3
|
+
* What the bytes ARE in the work ledger, for an upload that is the archived
|
|
4
|
+
* copy of an artifact that already has a name (`docs/policies/payout.md`).
|
|
5
|
+
*
|
|
6
|
+
* Without it the server keys the Resource on the attachment id, which is right
|
|
7
|
+
* for a screenshot and wrong for a named document: the coordinate somebody
|
|
8
|
+
* cited and the copy nobody can match to it become two Resources.
|
|
9
|
+
*
|
|
10
|
+
* Both upload paths carry it. On the direct-to-storage path it is declared at
|
|
11
|
+
* INTENT time and persisted on the attachment row, because `complete` — which
|
|
12
|
+
* writes the receipt — runs in a later request that never sees the intent's
|
|
13
|
+
* body. Without that, a Deliverable's ledger identity would depend on its
|
|
14
|
+
* SIZE, which is an implementation detail deciding a durable record.
|
|
15
|
+
*/
|
|
16
|
+
export interface TaskAssetLedgerResource {
|
|
17
|
+
identity: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
expectationIds?: string[];
|
|
20
|
+
}
|
|
2
21
|
export interface UploadedTaskAsset {
|
|
3
22
|
id: string;
|
|
4
23
|
/**
|
|
@@ -35,6 +54,7 @@ export declare function uploadTaskAssetFile(opts: {
|
|
|
35
54
|
taskId: string;
|
|
36
55
|
filePath: string;
|
|
37
56
|
role?: TaskAssetRole;
|
|
57
|
+
ledger?: TaskAssetLedgerResource;
|
|
38
58
|
}): Promise<UploadedTaskAsset>;
|
|
39
59
|
/**
|
|
40
60
|
* Upload every `--attach` file and return the reference objects an Update or
|
|
@@ -105,7 +105,7 @@ async function readTaskForUpload(taskId) {
|
|
|
105
105
|
* Throws a plain Error; callers decide how to surface it.
|
|
106
106
|
*/
|
|
107
107
|
async function uploadTaskAssetFile(opts) {
|
|
108
|
-
const { taskId, filePath, role } = opts;
|
|
108
|
+
const { taskId, filePath, role, ledger } = opts;
|
|
109
109
|
if (!fs.existsSync(filePath)) {
|
|
110
110
|
throw new Error(`File not found: ${filePath}`);
|
|
111
111
|
}
|
|
@@ -130,13 +130,13 @@ async function uploadTaskAssetFile(opts) {
|
|
|
130
130
|
if (sessionPath) {
|
|
131
131
|
await readTaskForUpload(taskId);
|
|
132
132
|
result = direct
|
|
133
|
-
? await sessionDirectUpload({ filePath, size, filename, mimeType, role })
|
|
134
|
-
: await sessionBufferedUpload({ filePath, filename, mimeType, role });
|
|
133
|
+
? await sessionDirectUpload({ filePath, size, filename, mimeType, role, ledger })
|
|
134
|
+
: await sessionBufferedUpload({ filePath, filename, mimeType, role, ledger });
|
|
135
135
|
}
|
|
136
136
|
else {
|
|
137
137
|
result = direct
|
|
138
|
-
? await genericDirectUpload({ taskId, filePath, size, filename, mimeType, role })
|
|
139
|
-
: await genericBufferedUpload({ taskId, filePath, filename, mimeType, role });
|
|
138
|
+
? await genericDirectUpload({ taskId, filePath, size, filename, mimeType, role, ledger })
|
|
139
|
+
: await genericBufferedUpload({ taskId, filePath, filename, mimeType, role, ledger });
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
catch (err) {
|
|
@@ -205,23 +205,31 @@ function taskAssetMarkdownRef(asset) {
|
|
|
205
205
|
* The buffered path holds the file in memory by design: it is capped at the
|
|
206
206
|
* buffered limit, and the server needs the whole body to canonicalize it.
|
|
207
207
|
*/
|
|
208
|
-
function fileFormData(filePath, filename, mimeType, role) {
|
|
208
|
+
function fileFormData(filePath, filename, mimeType, role, ledger) {
|
|
209
209
|
const fd = new FormData();
|
|
210
210
|
fd.append('file', new node_buffer_1.Blob([fs.readFileSync(filePath)], { type: mimeType }), filename);
|
|
211
211
|
if (role)
|
|
212
212
|
fd.append('role', role);
|
|
213
|
+
if (ledger?.identity) {
|
|
214
|
+
fd.append('identity', ledger.identity);
|
|
215
|
+
if (ledger.title)
|
|
216
|
+
fd.append('title', ledger.title);
|
|
217
|
+
if (ledger.expectationIds?.length) {
|
|
218
|
+
fd.append('expectationIds', JSON.stringify(ledger.expectationIds));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
213
221
|
return fd;
|
|
214
222
|
}
|
|
215
223
|
async function genericBufferedUpload(p) {
|
|
216
224
|
return data_provider_1.dataService.uploadTaskAttachment({
|
|
217
225
|
taskId: p.taskId,
|
|
218
|
-
formData: fileFormData(p.filePath, p.filename, p.mimeType, p.role),
|
|
226
|
+
formData: fileFormData(p.filePath, p.filename, p.mimeType, p.role, p.ledger),
|
|
219
227
|
});
|
|
220
228
|
}
|
|
221
229
|
async function sessionBufferedUpload(p) {
|
|
222
230
|
return (0, api_fetch_1.apiFetch)((await (0, session_task_endpoints_1.sessionScopedTaskPath)('attachment')), {
|
|
223
231
|
method: 'POST',
|
|
224
|
-
body: fileFormData(p.filePath, p.filename, p.mimeType, p.role),
|
|
232
|
+
body: fileFormData(p.filePath, p.filename, p.mimeType, p.role, p.ledger),
|
|
225
233
|
});
|
|
226
234
|
}
|
|
227
235
|
async function genericDirectUpload(p) {
|
|
@@ -232,6 +240,13 @@ async function genericDirectUpload(p) {
|
|
|
232
240
|
sizeBytes: p.size,
|
|
233
241
|
sha256: await sha256OfFile(p.filePath),
|
|
234
242
|
role: p.role,
|
|
243
|
+
...(p.ledger?.identity
|
|
244
|
+
? {
|
|
245
|
+
identity: p.ledger.identity,
|
|
246
|
+
title: p.ledger.title,
|
|
247
|
+
expectationIds: p.ledger.expectationIds,
|
|
248
|
+
}
|
|
249
|
+
: {}),
|
|
235
250
|
});
|
|
236
251
|
if (!intent.uploadUrl)
|
|
237
252
|
return intent.attachment;
|
|
@@ -257,6 +272,13 @@ async function sessionDirectUpload(p) {
|
|
|
257
272
|
sizeBytes: p.size,
|
|
258
273
|
sha256: await sha256OfFile(p.filePath),
|
|
259
274
|
...(p.role ? { role: p.role } : {}),
|
|
275
|
+
...(p.ledger?.identity
|
|
276
|
+
? {
|
|
277
|
+
identity: p.ledger.identity,
|
|
278
|
+
title: p.ledger.title,
|
|
279
|
+
expectationIds: p.ledger.expectationIds,
|
|
280
|
+
}
|
|
281
|
+
: {}),
|
|
260
282
|
},
|
|
261
283
|
});
|
|
262
284
|
if (!intent.uploadUrl)
|
|
@@ -133,4 +133,27 @@ export declare const taskChatApi: {
|
|
|
133
133
|
*/
|
|
134
134
|
taskHistory: (id: string, query?: Query) => Promise<Json>;
|
|
135
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
* `POST /api/tasks/:taskId/labels/suggest` — the on-demand half of the
|
|
138
|
+
* create-time `_labelGuidance` hint. The server keeps the model call off the
|
|
139
|
+
* task-create path (the hottest write in the product); this is how a caller
|
|
140
|
+
* pays for ONE suggestion when it actually wants it. Advisory only: the model
|
|
141
|
+
* chooses from the declared vocabulary and nothing is written.
|
|
142
|
+
*
|
|
143
|
+
* `apiFetch` rather than `request.post` for consistency with the lib's other
|
|
144
|
+
* standalone verbs; either would do — nothing here needs the idempotency
|
|
145
|
+
* stamp, because a suggestion is a read in POST clothing.
|
|
146
|
+
*/
|
|
147
|
+
export interface TaskLabelSuggestion {
|
|
148
|
+
id?: string;
|
|
149
|
+
name?: string;
|
|
150
|
+
}
|
|
151
|
+
export interface TaskLabelSuggestionResponse {
|
|
152
|
+
taskId?: string;
|
|
153
|
+
identifier?: string;
|
|
154
|
+
/** Size of the applicable vocabulary AFTER the task's own labels are excluded. */
|
|
155
|
+
vocabularySize?: number;
|
|
156
|
+
suggestions?: TaskLabelSuggestion[];
|
|
157
|
+
}
|
|
158
|
+
export declare function taskLabelSuggestion(taskId: string): Promise<TaskLabelSuggestionResponse>;
|
|
136
159
|
export {};
|
package/dist/lib/task-extras.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.taskRunHandover = taskRunHandover;
|
|
|
6
6
|
exports.taskRunFork = taskRunFork;
|
|
7
7
|
exports.taskRunPromote = taskRunPromote;
|
|
8
8
|
exports.parseExecutionTargetRef = parseExecutionTargetRef;
|
|
9
|
+
exports.taskLabelSuggestion = taskLabelSuggestion;
|
|
9
10
|
/**
|
|
10
11
|
* task-extras.ts — the `/api/tasks` endpoints that have no `dataService.*`
|
|
11
12
|
* wrapper, gathered so every one of them is reachable from `skrr`.
|
|
@@ -185,3 +186,8 @@ exports.taskChatApi = {
|
|
|
185
186
|
*/
|
|
186
187
|
taskHistory: (id, query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/transcript`, query)),
|
|
187
188
|
};
|
|
189
|
+
function taskLabelSuggestion(taskId) {
|
|
190
|
+
return (0, api_fetch_1.apiFetch)(`${base(taskId)}/labels/suggest`, {
|
|
191
|
+
method: 'POST',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
@@ -1,11 +1,37 @@
|
|
|
1
|
+
export type CliInstallKind = 'npm-global' | 'npm-local' | 'dev' | 'bundled' | 'other';
|
|
2
|
+
interface CheckCache {
|
|
3
|
+
/** Epoch ms of the last successful refresh. */
|
|
4
|
+
lastCheckAt: number;
|
|
5
|
+
/** Latest advertised CLI version, or null if the API had none. */
|
|
6
|
+
latest: string | null;
|
|
7
|
+
/** npm package to update (advisory copy), or null. */
|
|
8
|
+
npmPackage: string | null;
|
|
9
|
+
/** baseURL the cache was fetched against — invalidates on server switch. */
|
|
10
|
+
baseURL: string;
|
|
11
|
+
/** Resolved install shape, classified during the last refresh. */
|
|
12
|
+
install?: {
|
|
13
|
+
kind: CliInstallKind;
|
|
14
|
+
writable?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** Recorded BEFORE a background self-update is scheduled. */
|
|
17
|
+
autoUpdate?: {
|
|
18
|
+
attemptedAt: number;
|
|
19
|
+
version: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
1
22
|
/** Trailing-slash- and case-insensitive normalization for baseURL compares. */
|
|
2
23
|
export declare function normalizeBaseUrl(url: string): string;
|
|
3
24
|
/**
|
|
4
25
|
* True when the advisory must stay silent regardless of version state:
|
|
5
|
-
* explicit suppression,
|
|
6
|
-
*
|
|
26
|
+
* explicit suppression, a desktop-app-bundled CLI (which auto-updates with
|
|
27
|
+
* the app and must not be told to `npm update -g`), or an image-baked install
|
|
28
|
+
* the control plane owns.
|
|
7
29
|
*/
|
|
8
30
|
export declare function isNudgeSuppressed(env?: NodeJS.ProcessEnv): boolean;
|
|
31
|
+
/** True when the background self-update is allowed to run at all. Suppression
|
|
32
|
+
* implies no auto-update — a user who asked for silence did not ask for a
|
|
33
|
+
* silent mutation of their global npm. */
|
|
34
|
+
export declare function isAutoUpdateSuppressed(env?: NodeJS.ProcessEnv): boolean;
|
|
9
35
|
/**
|
|
10
36
|
* True iff `current` is strictly older than `latest` by numeric release
|
|
11
37
|
* core. Conservative: any unparseable input returns false (no nudge).
|
|
@@ -13,19 +39,66 @@ export declare function isNudgeSuppressed(env?: NodeJS.ProcessEnv): boolean;
|
|
|
13
39
|
* we never nag someone testing a prerelease of the latest line.
|
|
14
40
|
*/
|
|
15
41
|
export declare function isOlderVersion(current: string, latest: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve the package directory this process was launched from when it lives
|
|
44
|
+
* under `node_modules/@skrr-ai/cli` (any npm install — global or project-local),
|
|
45
|
+
* or null. Probes both the raw entry path and its realpath because the bin is
|
|
46
|
+
* usually a symlink into the package.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveCliPackageDir(argv?: readonly string[]): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Classify how this CLI was installed. `npmGlobalRoot` (from `npm root -g`)
|
|
51
|
+
* distinguishes a global install — which we may auto-update — from a
|
|
52
|
+
* project-local dependency, whose bytes belong to that project's package.json.
|
|
53
|
+
* `dev` is a checkout launched via its own `bin/run.js`: a `src/commands`
|
|
54
|
+
* dir beside `dist` exists only in a checkout — published packages ship
|
|
55
|
+
* `dist` and no `src`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function classifyCliInstall(env: NodeJS.ProcessEnv, argv: readonly string[], npmGlobalRoot: string | null): {
|
|
58
|
+
kind: CliInstallKind;
|
|
59
|
+
writable?: boolean;
|
|
60
|
+
};
|
|
16
61
|
/**
|
|
17
62
|
* Build the one-line stderr advisory, or null when no nudge is warranted.
|
|
18
|
-
*
|
|
63
|
+
* `installKind` tailors the command to the bytes' owner: a project-local dep
|
|
64
|
+
* is updated inside its project, a dev checkout is rebuilt — telling either
|
|
65
|
+
* to `npm update -g` would fix the wrong install.
|
|
19
66
|
*/
|
|
20
|
-
export declare function buildNudgeLine(currentVersion: string, latest: string | null, npmPackage: string | null): string | null;
|
|
67
|
+
export declare function buildNudgeLine(currentVersion: string, latest: string | null, npmPackage: string | null, installKind?: CliInstallKind): string | null;
|
|
68
|
+
export type CliUpdateAction = {
|
|
69
|
+
type: 'nudge';
|
|
70
|
+
line: string;
|
|
71
|
+
} | {
|
|
72
|
+
type: 'auto-update';
|
|
73
|
+
version: string;
|
|
74
|
+
pkg: string;
|
|
75
|
+
line: string;
|
|
76
|
+
} | null;
|
|
77
|
+
/**
|
|
78
|
+
* Decide, synchronously and from cache alone, what this command should do
|
|
79
|
+
* about its version state. Pure — exported for direct unit testing.
|
|
80
|
+
*
|
|
81
|
+
* AUTO-UPDATE fires at most once per TTL window per target version, and only
|
|
82
|
+
* for a provably writable npm-global install on an interactive TTY. An attempt
|
|
83
|
+
* that didn't take (still outdated next run) falls back to the manual nudge
|
|
84
|
+
* rather than retrying immediately.
|
|
85
|
+
*/
|
|
86
|
+
export declare function decideCliUpdateAction(args: {
|
|
87
|
+
currentVersion: string;
|
|
88
|
+
cache: CheckCache | null;
|
|
89
|
+
env: NodeJS.ProcessEnv;
|
|
90
|
+
isTTY: boolean;
|
|
91
|
+
now?: number;
|
|
92
|
+
}): CliUpdateAction;
|
|
21
93
|
/**
|
|
22
94
|
* Entry point, called once per command from `BaseCommand.init()`.
|
|
23
95
|
*
|
|
24
|
-
* Synchronous by design: it decides
|
|
25
|
-
*
|
|
26
|
-
*
|
|
96
|
+
* Synchronous by design: it decides from the cache (no network on the hot
|
|
97
|
+
* path) and only kicks off a background refresh when the cache is stale,
|
|
98
|
+
* missing, or from a different server. Returns immediately.
|
|
27
99
|
*/
|
|
28
100
|
export declare function maybeWarnOutdatedCli(opts: {
|
|
29
101
|
currentVersion: string;
|
|
30
102
|
baseURL: string;
|
|
31
103
|
}): void;
|
|
104
|
+
export {};
|