@skrr-ai/cli 0.1.95 → 0.1.97
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 +22 -0
- package/dist/commands/agent/message/send.d.ts +2 -0
- package/dist/commands/agent/message/send.js +75 -5
- package/dist/commands/agents/chat.js +1 -1
- package/dist/commands/agents/create.d.ts +0 -3
- package/dist/commands/agents/create.js +0 -26
- package/dist/commands/agents/egress.d.ts +17 -0
- package/dist/commands/agents/egress.js +84 -0
- package/dist/commands/agents/mailbox/messages.d.ts +14 -0
- package/dist/commands/agents/mailbox/messages.js +52 -0
- package/dist/commands/agents/mailbox/show.d.ts +13 -0
- package/dist/commands/agents/mailbox/show.js +52 -0
- package/dist/commands/agents/operating-plan.js +8 -0
- package/dist/commands/agents/roles/capture.d.ts +16 -0
- package/dist/commands/agents/roles/capture.js +53 -0
- package/dist/commands/agents/roles/install.d.ts +1 -0
- package/dist/commands/agents/roles/install.js +8 -1
- package/dist/commands/agents/roles/preview.d.ts +2 -0
- package/dist/commands/agents/roles/preview.js +27 -3
- package/dist/commands/agents/update.d.ts +0 -3
- package/dist/commands/agents/update.js +1 -31
- package/dist/commands/agents/usage-cap.d.ts +4 -1
- package/dist/commands/agents/usage-cap.js +49 -10
- package/dist/commands/code/jobs/show.js +12 -0
- package/dist/commands/commitments/action-proposals/decide.d.ts +2 -0
- package/dist/commands/commitments/action-proposals/decide.js +12 -0
- package/dist/commands/commitments/action-proposals.js +7 -0
- package/dist/commands/commitments/create.d.ts +1 -0
- package/dist/commands/commitments/create.js +17 -1
- package/dist/commands/commitments/delivery.d.ts +1 -0
- package/dist/commands/commitments/delivery.js +11 -1
- package/dist/commands/commitments/doctor.js +4 -0
- package/dist/commands/commitments/effective-policy.js +26 -0
- package/dist/commands/commitments/endpoints/create.js +5 -2
- package/dist/commands/commitments/observations.d.ts +10 -0
- package/dist/commands/commitments/observations.js +88 -0
- package/dist/commands/commitments/pause.d.ts +1 -1
- package/dist/commands/commitments/pause.js +4 -3
- package/dist/commands/commitments/preflight.js +2 -1
- package/dist/commands/commitments/reports.d.ts +2 -0
- package/dist/commands/commitments/reports.js +22 -4
- package/dist/commands/commitments/update.d.ts +1 -0
- package/dist/commands/commitments/update.js +35 -5
- package/dist/commands/daemon/install.js +1 -1
- package/dist/commands/grants/create.d.ts +1 -0
- package/dist/commands/grants/create.js +8 -0
- package/dist/commands/grants/rotate.d.ts +5 -0
- package/dist/commands/grants/rotate.js +13 -1
- package/dist/commands/grants/update.d.ts +12 -0
- package/dist/commands/grants/update.js +27 -0
- package/dist/commands/machines/hosted/start.js +7 -1
- package/dist/commands/machines/list.js +4 -4
- package/dist/commands/measures/confirm.d.ts +1 -7
- package/dist/commands/measures/confirm.js +15 -14
- package/dist/commands/measures/list.d.ts +1 -7
- package/dist/commands/measures/list.js +1 -7
- package/dist/commands/measures/record.js +4 -4
- package/dist/commands/measures/show.d.ts +11 -0
- package/dist/commands/measures/show.js +26 -0
- package/dist/commands/northstars/governance/configure.d.ts +1 -0
- package/dist/commands/northstars/governance/configure.js +8 -1
- package/dist/commands/proposals/discard.d.ts +5 -0
- package/dist/commands/proposals/discard.js +8 -0
- package/dist/commands/proposals/keep.d.ts +5 -0
- package/dist/commands/proposals/keep.js +8 -0
- package/dist/commands/proposals/list.d.ts +15 -0
- package/dist/commands/proposals/list.js +74 -0
- package/dist/commands/proposals/show.d.ts +12 -0
- package/dist/commands/proposals/show.js +27 -0
- package/dist/commands/proposals/snooze.d.ts +5 -0
- package/dist/commands/proposals/snooze.js +8 -0
- package/dist/commands/signals/monitors/create.d.ts +9 -0
- package/dist/commands/signals/monitors/create.js +29 -0
- package/dist/commands/signals/monitors/list.d.ts +8 -0
- package/dist/commands/signals/monitors/list.js +16 -0
- package/dist/commands/signals/monitors/pause.d.ts +11 -0
- package/dist/commands/signals/monitors/pause.js +17 -0
- package/dist/commands/signals/monitors/resume.d.ts +11 -0
- package/dist/commands/signals/monitors/resume.js +17 -0
- package/dist/commands/signals/monitors/revise.d.ts +12 -0
- package/dist/commands/signals/monitors/revise.js +25 -0
- package/dist/commands/signals/monitors/show.d.ts +11 -0
- package/dist/commands/signals/monitors/show.js +17 -0
- package/dist/commands/signals/monitors/test.d.ts +12 -0
- package/dist/commands/signals/monitors/test.js +25 -0
- package/dist/commands/signals/monitors/transitions.d.ts +11 -0
- package/dist/commands/signals/monitors/transitions.js +17 -0
- package/dist/commands/signals/monitors/validate.d.ts +9 -0
- package/dist/commands/signals/monitors/validate.js +24 -0
- package/dist/commands/signals/schemas/list.d.ts +8 -0
- package/dist/commands/signals/schemas/list.js +16 -0
- package/dist/commands/signals/schemas/show.d.ts +11 -0
- package/dist/commands/signals/schemas/show.js +17 -0
- package/dist/commands/signals/sources/list.d.ts +8 -0
- package/dist/commands/signals/sources/list.js +16 -0
- package/dist/commands/signals/sources/receipts.d.ts +11 -0
- package/dist/commands/signals/sources/receipts.js +17 -0
- package/dist/commands/signals/sources/show.d.ts +11 -0
- package/dist/commands/signals/sources/show.js +17 -0
- package/dist/commands/spaces/usage.d.ts +12 -0
- package/dist/commands/spaces/usage.js +28 -0
- package/dist/commands/spaces/workflows/run.js +3 -0
- package/dist/commands/spaces/workflows/runs.js +2 -1
- package/dist/commands/spaces/workflows/update.d.ts +6 -1
- package/dist/commands/spaces/workflows/update.js +34 -2
- package/dist/commands/tasks/cascade-status.d.ts +2 -0
- package/dist/commands/tasks/cascade-status.js +27 -1
- package/dist/commands/tasks/comments/add.js +29 -20
- package/dist/commands/tasks/complete.js +7 -4
- package/dist/commands/tasks/create.d.ts +4 -0
- package/dist/commands/tasks/create.js +16 -0
- package/dist/commands/tasks/deliverable/add.js +17 -7
- package/dist/commands/tasks/economics-compare.d.ts +15 -0
- package/dist/commands/tasks/economics-compare.js +60 -0
- package/dist/commands/tasks/events/append.js +6 -5
- package/dist/commands/tasks/expectations/assess.js +4 -4
- package/dist/commands/tasks/expectations/evaluate.d.ts +13 -0
- package/dist/commands/tasks/expectations/evaluate.js +43 -0
- package/dist/commands/tasks/list.d.ts +1 -0
- package/dist/commands/tasks/list.js +44 -1
- package/dist/commands/tasks/move.js +15 -11
- package/dist/commands/tasks/report.js +19 -11
- package/dist/commands/tasks/result/submit.js +5 -4
- package/dist/commands/tasks/resume/save.js +5 -4
- package/dist/commands/tasks/review.js +4 -4
- package/dist/commands/tasks/show.d.ts +5 -0
- package/dist/commands/tasks/show.js +17 -0
- package/dist/commands/tasks/update.d.ts +4 -0
- package/dist/commands/tasks/update.js +9 -0
- package/dist/commands/tasks/updates/add.js +5 -4
- package/dist/commands/tasks/workflow-findings.js +2 -2
- package/dist/commands/triggers/create.d.ts +2 -0
- package/dist/commands/triggers/create.js +15 -0
- package/dist/commands/workspaces/grants.d.ts +12 -0
- package/dist/commands/workspaces/grants.js +31 -0
- package/dist/commands/workspaces/stewardship.d.ts +13 -0
- package/dist/commands/workspaces/stewardship.js +34 -0
- package/dist/lib/agent-config.d.ts +0 -12
- package/dist/lib/agent-config.js +1 -27
- package/dist/lib/agent-mailbox.d.ts +35 -0
- package/dist/lib/agent-mailbox.js +55 -0
- package/dist/lib/commitment-endpoints.d.ts +2 -1
- package/dist/lib/commitment-endpoints.js +2 -5
- package/dist/lib/commitment-product.d.ts +3 -1
- package/dist/lib/commitment-product.js +10 -0
- package/dist/lib/commitment-terms.js +1 -1
- package/dist/lib/commitments.d.ts +17 -7
- package/dist/lib/commitments.js +173 -85
- package/dist/lib/compasses.d.ts +14 -0
- package/dist/lib/compasses.js +25 -11
- package/dist/lib/grants.d.ts +5 -1
- package/dist/lib/grants.js +9 -1
- package/dist/lib/hosted-machines.d.ts +7 -0
- package/dist/lib/mailbox-human-command.d.ts +11 -0
- package/dist/lib/mailbox-human-command.js +41 -0
- package/dist/lib/measures.d.ts +28 -2
- package/dist/lib/measures.js +38 -14
- package/dist/lib/message-intent.d.ts +6 -2
- package/dist/lib/message-intent.js +1 -0
- package/dist/lib/northstars.js +2 -1
- package/dist/lib/proposal-decision-command.d.ts +19 -0
- package/dist/lib/proposal-decision-command.js +64 -0
- package/dist/lib/proposals.d.ts +8 -0
- package/dist/lib/proposals.js +22 -0
- package/dist/lib/roles.d.ts +141 -6
- package/dist/lib/roles.js +8 -2
- package/dist/lib/session-task-write.d.ts +18 -0
- package/dist/lib/session-task-write.js +43 -0
- package/dist/lib/signals.d.ts +20 -0
- package/dist/lib/signals.js +24 -0
- package/dist/lib/space-usage.d.ts +3 -0
- package/dist/lib/space-usage.js +17 -0
- package/dist/lib/stewardship-output.d.ts +4 -0
- package/dist/lib/stewardship-output.js +82 -0
- package/dist/lib/task-asset-upload.d.ts +3 -1
- package/dist/lib/task-asset-upload.js +19 -22
- package/dist/lib/task-economics.d.ts +16 -0
- package/dist/lib/task-economics.js +22 -0
- package/dist/lib/triggers.d.ts +11 -3
- package/dist/lib/triggers.js +58 -1
- package/dist/lib/unsupported-managed-task-write.d.ts +2 -0
- package/dist/lib/unsupported-managed-task-write.js +12 -0
- package/dist/lib/usage-discovery.d.ts +10 -0
- package/dist/lib/usage-discovery.js +24 -3
- package/dist/lib/workflow-run-budget.d.ts +12 -0
- package/dist/lib/workflow-run-budget.js +37 -0
- package/dist/lib/workspaces.d.ts +48 -0
- package/dist/lib/workspaces.js +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/cliHandoffWire.d.ts +4 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/cliHandoffWire.js +14 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.d.ts +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +49 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/cliHandoffWire.d.ts +4 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/cliHandoffWire.js +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.d.ts +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +44 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +8017 -7086
- package/oclif.manifest.json +3872 -1167
- package/package.json +22 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describeRunBudget = describeRunBudget;
|
|
4
|
+
exports.runStatusLabel = runStatusLabel;
|
|
5
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
|
+
/**
|
|
7
|
+
* Human lines for a run's duration budget and for a run the budget stopped.
|
|
8
|
+
*
|
|
9
|
+
* The server derives `budget` per read and stamps `error.code =
|
|
10
|
+
* WORKFLOW_RUN_DEADLINE` on a run it cancelled; this only words them. A run with
|
|
11
|
+
* neither prints nothing: no budget is not "0 minutes left".
|
|
12
|
+
*/
|
|
13
|
+
function describeRunBudget(run) {
|
|
14
|
+
const lines = [];
|
|
15
|
+
const error = run.error;
|
|
16
|
+
if (error?.code === data_provider_1.WORKFLOW_RUN_DEADLINE) {
|
|
17
|
+
lines.push(`Stopped: ${error.code}${error.message ? ` - ${error.message}` : ''}`);
|
|
18
|
+
}
|
|
19
|
+
const budget = run.budget;
|
|
20
|
+
if (budget && Number.isFinite(budget.maxDurationMs)) {
|
|
21
|
+
const limit = (0, data_provider_1.describeWorkflowDuration)(budget.maxDurationMs);
|
|
22
|
+
if (budget.exceeded)
|
|
23
|
+
lines.push(`Time limit: ${limit}, exceeded (deadline ${budget.deadlineAt})`);
|
|
24
|
+
else if (budget.remainingMs > 0)
|
|
25
|
+
lines.push(`Time limit: ${limit}, ${(0, data_provider_1.describeWorkflowDuration)(budget.remainingMs)} left (deadline ${budget.deadlineAt})`);
|
|
26
|
+
else
|
|
27
|
+
lines.push(`Time limit: ${limit} (deadline ${budget.deadlineAt})`);
|
|
28
|
+
}
|
|
29
|
+
return lines;
|
|
30
|
+
}
|
|
31
|
+
/** The status cell, naming a time-limit stop where the plain status would hide it. */
|
|
32
|
+
function runStatusLabel(run) {
|
|
33
|
+
const status = String(run.status ?? '-');
|
|
34
|
+
return run.error?.code === data_provider_1.WORKFLOW_RUN_DEADLINE
|
|
35
|
+
? `${status} (time limit)`
|
|
36
|
+
: status;
|
|
37
|
+
}
|
package/dist/lib/workspaces.d.ts
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
import type { GrantPublic } from '@skrr-ai/data-schemas';
|
|
2
|
+
export interface StewardshipSource {
|
|
3
|
+
name: string;
|
|
4
|
+
status: 'available' | 'unavailable';
|
|
5
|
+
truncated: boolean;
|
|
6
|
+
code?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface StewardshipCoverage {
|
|
9
|
+
complete: boolean;
|
|
10
|
+
truncated: boolean;
|
|
11
|
+
sources: StewardshipSource[];
|
|
12
|
+
}
|
|
13
|
+
export type WorkspaceGrantMetadata = Omit<GrantPublic, 'credential' | 'createdAt' | 'updatedAt'> & {
|
|
14
|
+
ownerUserId: string;
|
|
15
|
+
credential: (NonNullable<GrantPublic['credential']> & {
|
|
16
|
+
fingerprint?: string;
|
|
17
|
+
}) | null;
|
|
18
|
+
createdAt?: string;
|
|
19
|
+
updatedAt?: string;
|
|
20
|
+
referencedBy: string[] | null;
|
|
21
|
+
referencesTruncated: boolean;
|
|
22
|
+
};
|
|
23
|
+
export interface WorkspaceGrantReport {
|
|
24
|
+
workspaceId: string;
|
|
25
|
+
grants: WorkspaceGrantMetadata[] | null;
|
|
26
|
+
coverage: StewardshipCoverage;
|
|
27
|
+
}
|
|
28
|
+
export interface StewardshipCommitmentMetadata {
|
|
29
|
+
id: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
status?: string;
|
|
32
|
+
agentId?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface WorkspaceStewardshipReport extends WorkspaceGrantReport {
|
|
35
|
+
memberUserId: string;
|
|
36
|
+
membership: {
|
|
37
|
+
status: 'active' | 'absent' | 'unavailable';
|
|
38
|
+
role?: string;
|
|
39
|
+
};
|
|
40
|
+
commitments: StewardshipCommitmentMetadata[] | null;
|
|
41
|
+
approverSeats: StewardshipCommitmentMetadata[] | null;
|
|
42
|
+
agents: Array<{
|
|
43
|
+
id: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
}> | null;
|
|
46
|
+
}
|
|
47
|
+
export declare function getWorkspaceStewardship(workspaceId: string, memberUserId: string): Promise<WorkspaceStewardshipReport>;
|
|
48
|
+
export declare function listWorkspaceGrants(workspaceId: string): Promise<WorkspaceGrantReport>;
|
|
1
49
|
/**
|
|
2
50
|
* The workspaces this account belongs to.
|
|
3
51
|
*
|
package/dist/lib/workspaces.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorkspaceStewardship = getWorkspaceStewardship;
|
|
4
|
+
exports.listWorkspaceGrants = listWorkspaceGrants;
|
|
3
5
|
exports.describeUnselectedWorkspace = describeUnselectedWorkspace;
|
|
4
6
|
exports.listWorkspaces = listWorkspaces;
|
|
5
7
|
exports.ambientWorkspaceId = ambientWorkspaceId;
|
|
@@ -10,6 +12,12 @@ exports.getWorkspace = getWorkspace;
|
|
|
10
12
|
exports.matchWorkspace = matchWorkspace;
|
|
11
13
|
const api_fetch_1 = require("./api-fetch");
|
|
12
14
|
const triggers_1 = require("./triggers");
|
|
15
|
+
async function getWorkspaceStewardship(workspaceId, memberUserId) {
|
|
16
|
+
return (0, api_fetch_1.apiFetch)(`/api/workspaces/${encodeURIComponent(workspaceId)}/stewardship/members/${encodeURIComponent(memberUserId)}`);
|
|
17
|
+
}
|
|
18
|
+
async function listWorkspaceGrants(workspaceId) {
|
|
19
|
+
return (0, api_fetch_1.apiFetch)(`/api/workspaces/${encodeURIComponent(workspaceId)}/stewardship/grants`);
|
|
20
|
+
}
|
|
13
21
|
/**
|
|
14
22
|
* The server's workspace document can include presentation metadata such as an
|
|
15
23
|
* avatar source. This CLI surface is a selector, not a workspace export: keep
|
|
@@ -129,3 +129,7 @@ export interface CliHandoffDpopProofResponse {
|
|
|
129
129
|
proof: string;
|
|
130
130
|
}
|
|
131
131
|
export declare function parseCliHandoffDpopProofResponse(value: unknown): CliHandoffDpopProofResponse | null;
|
|
132
|
+
/** Persisted credential families; deployed values must not change. */
|
|
133
|
+
export declare const DELEGATED_AGENT_CLI_ID_PREFIX = "oversky-daemon-agent-cli-";
|
|
134
|
+
export declare const WORKLOAD_CLI_ID_PREFIX = "oversky-daemon-workload-cli-";
|
|
135
|
+
export declare function classifyCliFamilyId(id: unknown): 'agent' | 'workload' | 'person';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* must produce the full shape.
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CLI_HANDOFF_ERROR_DPOP_UNAVAILABLE = exports.CLI_HANDOFF_ERROR_DPOP_PROOF_REFUSED = exports.CLI_HANDOFF_DPOP_PROOF_PATH = exports.CLI_HANDOFF_ERROR_DPOP_REQUIRED = exports.CLI_HANDOFF_ERROR_BROKER_ONLY = exports.CLI_HANDOFF_TOKEN_ERROR_UNAVAILABLE = exports.CLI_HANDOFF_TOKEN_PATH = exports.CLI_HANDOFF_MODES = void 0;
|
|
21
|
+
exports.WORKLOAD_CLI_ID_PREFIX = exports.DELEGATED_AGENT_CLI_ID_PREFIX = exports.CLI_HANDOFF_ERROR_DPOP_UNAVAILABLE = exports.CLI_HANDOFF_ERROR_DPOP_PROOF_REFUSED = exports.CLI_HANDOFF_DPOP_PROOF_PATH = exports.CLI_HANDOFF_ERROR_DPOP_REQUIRED = exports.CLI_HANDOFF_ERROR_BROKER_ONLY = exports.CLI_HANDOFF_TOKEN_ERROR_UNAVAILABLE = exports.CLI_HANDOFF_TOKEN_PATH = exports.CLI_HANDOFF_MODES = void 0;
|
|
22
22
|
exports.parseCliHandoffDescriptor = parseCliHandoffDescriptor;
|
|
23
23
|
exports.normalizeHandoffModes = normalizeHandoffModes;
|
|
24
24
|
exports.advertisedHandoffModes = advertisedHandoffModes;
|
|
@@ -26,6 +26,7 @@ exports.descriptorOffersAccessToken = descriptorOffersAccessToken;
|
|
|
26
26
|
exports.descriptorOffersDpop = descriptorOffersDpop;
|
|
27
27
|
exports.parseCliHandoffTokenResponse = parseCliHandoffTokenResponse;
|
|
28
28
|
exports.parseCliHandoffDpopProofResponse = parseCliHandoffDpopProofResponse;
|
|
29
|
+
exports.classifyCliFamilyId = classifyCliFamilyId;
|
|
29
30
|
/**
|
|
30
31
|
* What a caller may redeem the descriptor secret for.
|
|
31
32
|
* - `refresh_family`: the legacy durable mint (90-day cli-scope family).
|
|
@@ -143,3 +144,15 @@ function parseCliHandoffDpopProofResponse(value) {
|
|
|
143
144
|
return null;
|
|
144
145
|
return { proof: v.proof };
|
|
145
146
|
}
|
|
147
|
+
/** Persisted credential families; deployed values must not change. */
|
|
148
|
+
exports.DELEGATED_AGENT_CLI_ID_PREFIX = 'oversky-daemon-agent-cli-';
|
|
149
|
+
exports.WORKLOAD_CLI_ID_PREFIX = 'oversky-daemon-workload-cli-';
|
|
150
|
+
function classifyCliFamilyId(id) {
|
|
151
|
+
if (typeof id !== 'string')
|
|
152
|
+
return 'person';
|
|
153
|
+
if (id.startsWith(exports.DELEGATED_AGENT_CLI_ID_PREFIX))
|
|
154
|
+
return 'agent';
|
|
155
|
+
if (id.startsWith(exports.WORKLOAD_CLI_ID_PREFIX))
|
|
156
|
+
return 'workload';
|
|
157
|
+
return 'person';
|
|
158
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** GitHub push diagnostics must never escape this parser as raw stderr. */
|
|
2
|
+
export declare const GITHUB_WORKFLOW_PERMISSION_REQUIRED = "github_workflow_permission_required";
|
|
3
|
+
export type GitHubPushRefusal = {
|
|
4
|
+
code: typeof GITHUB_WORKFLOW_PERMISSION_REQUIRED;
|
|
5
|
+
tokenKind: 'github_app' | 'oauth_app' | 'personal_access_token' | 'unknown';
|
|
6
|
+
paths: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function isWorkflowPath(value: unknown): boolean;
|
|
9
|
+
export declare function classifyGitHubPushRefusal(text: unknown): GitHubPushRefusal | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GITHUB_WORKFLOW_PERMISSION_REQUIRED = void 0;
|
|
4
|
+
exports.isWorkflowPath = isWorkflowPath;
|
|
5
|
+
exports.classifyGitHubPushRefusal = classifyGitHubPushRefusal;
|
|
6
|
+
/** GitHub push diagnostics must never escape this parser as raw stderr. */
|
|
7
|
+
exports.GITHUB_WORKFLOW_PERMISSION_REQUIRED = 'github_workflow_permission_required';
|
|
8
|
+
function workflowPath(value) {
|
|
9
|
+
if (typeof value !== 'string' || value.length > 240)
|
|
10
|
+
return null;
|
|
11
|
+
const path = value.replaceAll('\\', '/');
|
|
12
|
+
if (!/^\.github\/workflows\/[A-Za-z0-9_. /-]+$/.test(path))
|
|
13
|
+
return null;
|
|
14
|
+
const parts = path.split('/');
|
|
15
|
+
if (parts.some((part) => !part.trim() || part !== part.trim() || part === '.' || part === '..'))
|
|
16
|
+
return null;
|
|
17
|
+
return path;
|
|
18
|
+
}
|
|
19
|
+
function isWorkflowPath(value) {
|
|
20
|
+
return workflowPath(value) !== null;
|
|
21
|
+
}
|
|
22
|
+
function classifyGitHubPushRefusal(text) {
|
|
23
|
+
if (typeof text !== 'string')
|
|
24
|
+
return null;
|
|
25
|
+
// Bound parsing work. Git prints the rejection LAST, after any amount of
|
|
26
|
+
// progress output, so keep the tail; truncated diagnostics keep the generic refusal.
|
|
27
|
+
const input = text.slice(-64 * 1024);
|
|
28
|
+
const pattern = /refusing to allow (?:a|an) (GitHub App|OAuth App|Personal Access Token) to create or update workflow [`'"]([^`'"\r\n]+)[`'"] without [`'"]workflows?[`'"] (?:permission|scope)/gi;
|
|
29
|
+
const paths = [];
|
|
30
|
+
let tokenKind = 'unknown';
|
|
31
|
+
for (const match of input.matchAll(pattern)) {
|
|
32
|
+
const path = workflowPath(match[2]);
|
|
33
|
+
if (!path)
|
|
34
|
+
continue;
|
|
35
|
+
if (tokenKind === 'unknown') {
|
|
36
|
+
tokenKind =
|
|
37
|
+
match[1].toLowerCase() === 'github app'
|
|
38
|
+
? 'github_app'
|
|
39
|
+
: match[1].toLowerCase() === 'oauth app'
|
|
40
|
+
? 'oauth_app'
|
|
41
|
+
: 'personal_access_token';
|
|
42
|
+
}
|
|
43
|
+
if (!paths.includes(path))
|
|
44
|
+
paths.push(path);
|
|
45
|
+
if (paths.length === 10)
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return paths.length ? { code: exports.GITHUB_WORKFLOW_PERMISSION_REQUIRED, tokenKind, paths } : null;
|
|
49
|
+
}
|
|
@@ -129,3 +129,7 @@ export interface CliHandoffDpopProofResponse {
|
|
|
129
129
|
proof: string;
|
|
130
130
|
}
|
|
131
131
|
export declare function parseCliHandoffDpopProofResponse(value: unknown): CliHandoffDpopProofResponse | null;
|
|
132
|
+
/** Persisted credential families; deployed values must not change. */
|
|
133
|
+
export declare const DELEGATED_AGENT_CLI_ID_PREFIX = "oversky-daemon-agent-cli-";
|
|
134
|
+
export declare const WORKLOAD_CLI_ID_PREFIX = "oversky-daemon-workload-cli-";
|
|
135
|
+
export declare function classifyCliFamilyId(id: unknown): 'agent' | 'workload' | 'person';
|
|
@@ -133,3 +133,15 @@ export function parseCliHandoffDpopProofResponse(value) {
|
|
|
133
133
|
return null;
|
|
134
134
|
return { proof: v.proof };
|
|
135
135
|
}
|
|
136
|
+
/** Persisted credential families; deployed values must not change. */
|
|
137
|
+
export const DELEGATED_AGENT_CLI_ID_PREFIX = 'oversky-daemon-agent-cli-';
|
|
138
|
+
export const WORKLOAD_CLI_ID_PREFIX = 'oversky-daemon-workload-cli-';
|
|
139
|
+
export function classifyCliFamilyId(id) {
|
|
140
|
+
if (typeof id !== 'string')
|
|
141
|
+
return 'person';
|
|
142
|
+
if (id.startsWith(DELEGATED_AGENT_CLI_ID_PREFIX))
|
|
143
|
+
return 'agent';
|
|
144
|
+
if (id.startsWith(WORKLOAD_CLI_ID_PREFIX))
|
|
145
|
+
return 'workload';
|
|
146
|
+
return 'person';
|
|
147
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** GitHub push diagnostics must never escape this parser as raw stderr. */
|
|
2
|
+
export declare const GITHUB_WORKFLOW_PERMISSION_REQUIRED = "github_workflow_permission_required";
|
|
3
|
+
export type GitHubPushRefusal = {
|
|
4
|
+
code: typeof GITHUB_WORKFLOW_PERMISSION_REQUIRED;
|
|
5
|
+
tokenKind: 'github_app' | 'oauth_app' | 'personal_access_token' | 'unknown';
|
|
6
|
+
paths: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function isWorkflowPath(value: unknown): boolean;
|
|
9
|
+
export declare function classifyGitHubPushRefusal(text: unknown): GitHubPushRefusal | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** GitHub push diagnostics must never escape this parser as raw stderr. */
|
|
2
|
+
export const GITHUB_WORKFLOW_PERMISSION_REQUIRED = 'github_workflow_permission_required';
|
|
3
|
+
function workflowPath(value) {
|
|
4
|
+
if (typeof value !== 'string' || value.length > 240)
|
|
5
|
+
return null;
|
|
6
|
+
const path = value.replaceAll('\\', '/');
|
|
7
|
+
if (!/^\.github\/workflows\/[A-Za-z0-9_. /-]+$/.test(path))
|
|
8
|
+
return null;
|
|
9
|
+
const parts = path.split('/');
|
|
10
|
+
if (parts.some((part) => !part.trim() || part !== part.trim() || part === '.' || part === '..'))
|
|
11
|
+
return null;
|
|
12
|
+
return path;
|
|
13
|
+
}
|
|
14
|
+
export function isWorkflowPath(value) {
|
|
15
|
+
return workflowPath(value) !== null;
|
|
16
|
+
}
|
|
17
|
+
export function classifyGitHubPushRefusal(text) {
|
|
18
|
+
if (typeof text !== 'string')
|
|
19
|
+
return null;
|
|
20
|
+
// Bound parsing work. Git prints the rejection LAST, after any amount of
|
|
21
|
+
// progress output, so keep the tail; truncated diagnostics keep the generic refusal.
|
|
22
|
+
const input = text.slice(-64 * 1024);
|
|
23
|
+
const pattern = /refusing to allow (?:a|an) (GitHub App|OAuth App|Personal Access Token) to create or update workflow [`'"]([^`'"\r\n]+)[`'"] without [`'"]workflows?[`'"] (?:permission|scope)/gi;
|
|
24
|
+
const paths = [];
|
|
25
|
+
let tokenKind = 'unknown';
|
|
26
|
+
for (const match of input.matchAll(pattern)) {
|
|
27
|
+
const path = workflowPath(match[2]);
|
|
28
|
+
if (!path)
|
|
29
|
+
continue;
|
|
30
|
+
if (tokenKind === 'unknown') {
|
|
31
|
+
tokenKind =
|
|
32
|
+
match[1].toLowerCase() === 'github app'
|
|
33
|
+
? 'github_app'
|
|
34
|
+
: match[1].toLowerCase() === 'oauth app'
|
|
35
|
+
? 'oauth_app'
|
|
36
|
+
: 'personal_access_token';
|
|
37
|
+
}
|
|
38
|
+
if (!paths.includes(path))
|
|
39
|
+
paths.push(path);
|
|
40
|
+
if (paths.length === 10)
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return paths.length ? { code: GITHUB_WORKFLOW_PERMISSION_REQUIRED, tokenKind, paths } : null;
|
|
44
|
+
}
|
|
@@ -14,6 +14,16 @@
|
|
|
14
14
|
"default": "./dist/cjs/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
+
"./github-push-refusal": {
|
|
18
|
+
"import": {
|
|
19
|
+
"types": "./dist/esm/githubPushRefusal.d.ts",
|
|
20
|
+
"default": "./dist/esm/githubPushRefusal.js"
|
|
21
|
+
},
|
|
22
|
+
"require": {
|
|
23
|
+
"types": "./dist/cjs/githubPushRefusal.d.ts",
|
|
24
|
+
"default": "./dist/cjs/githubPushRefusal.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
17
27
|
"./refresh-classification": {
|
|
18
28
|
"import": {
|
|
19
29
|
"types": "./dist/esm/refreshClassification.d.ts",
|