@skrr-ai/cli 0.1.232 → 0.1.233
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 +29 -13
- package/bin/dev.cjs +0 -1
- package/bin/run.js +0 -15
- package/dist/base-command.d.ts +6 -1
- package/dist/base-command.js +24 -4
- package/dist/commands/agenda/plan.d.ts +2 -1
- package/dist/commands/agenda/plan.js +18 -4
- package/dist/commands/agents/chat.d.ts +2 -0
- package/dist/commands/agents/chat.js +59 -13
- package/dist/commands/agents/eval/list.d.ts +4 -0
- package/dist/commands/agents/eval/list.js +33 -0
- package/dist/commands/agents/permissions/policy.js +25 -2
- package/dist/commands/agents/spawn.js +61 -24
- package/dist/commands/agents/triggers/fire.js +1 -1
- package/dist/commands/agents/triggers/runs.js +3 -0
- package/dist/commands/code/jobs/approve.d.ts +1 -11
- package/dist/commands/code/jobs/approve.js +3 -15
- package/dist/commands/code/jobs/cancel.js +3 -2
- package/dist/commands/code/jobs/index.js +1 -1
- package/dist/commands/code/jobs/list.js +4 -11
- package/dist/commands/code/jobs/run.js +13 -7
- package/dist/commands/code/jobs/show.js +51 -6
- package/dist/commands/commands.d.ts +1 -0
- package/dist/commands/commands.js +5 -1
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/context.js +1 -0
- package/dist/commands/duties/catalog/add.d.ts +18 -0
- package/dist/commands/duties/catalog/add.js +52 -0
- package/dist/commands/duties/catalog/index.d.ts +18 -0
- package/dist/commands/duties/catalog/index.js +88 -0
- package/dist/commands/duties/receipt.js +56 -1
- package/dist/commands/goals/planner-compare.js +5 -3
- package/dist/commands/instructions/discovery.d.ts +10 -0
- package/dist/commands/instructions/discovery.js +74 -0
- package/dist/commands/runs/admission.d.ts +12 -0
- package/dist/commands/runs/admission.js +66 -0
- package/dist/commands/runs/events.d.ts +2 -0
- package/dist/commands/runs/events.js +40 -10
- package/dist/commands/runs/list.d.ts +7 -1
- package/dist/commands/runs/list.js +81 -17
- package/dist/commands/runs/show.d.ts +1 -0
- package/dist/commands/runs/show.js +225 -15
- package/dist/commands/runs/stop.d.ts +1 -0
- package/dist/commands/runs/stop.js +34 -7
- package/dist/commands/runs/transcript.d.ts +2 -0
- package/dist/commands/runs/transcript.js +102 -17
- package/dist/commands/tasks/attachments/download.d.ts +1 -0
- package/dist/commands/tasks/attachments/download.js +6 -4
- package/dist/commands/tasks/attachments/source.d.ts +6 -0
- package/dist/commands/tasks/attachments/source.js +18 -0
- package/dist/commands/tasks/chat/exchange.d.ts +0 -14
- package/dist/commands/tasks/chat/exchange.js +8 -39
- package/dist/commands/tasks/chat/reply-run.d.ts +15 -0
- package/dist/commands/tasks/chat/reply-run.js +69 -0
- package/dist/commands/tasks/complete.js +1 -1
- package/dist/commands/tasks/lifecycle/transition.d.ts +1 -0
- package/dist/commands/tasks/lifecycle/transition.js +51 -13
- package/dist/commands/tasks/operations/show.js +5 -0
- package/dist/commands/tasks/result/submit.js +4 -2
- package/dist/commands/tasks/retry.js +25 -16
- package/dist/commands/triggers/audit.js +3 -1
- package/dist/commands/triggers/fire-detail.js +4 -1
- package/dist/commands/triggers/fire.js +1 -1
- package/dist/commands/usage.d.ts +1 -0
- package/dist/commands/usage.js +1 -0
- package/dist/generated/agent-guides.json +64 -712
- package/dist/help.d.ts +2 -7
- package/dist/help.js +13 -7
- package/dist/hooks/init.js +10 -0
- package/dist/lib/agent-evals.d.ts +1 -1
- package/dist/lib/agent-evals.js +13 -3
- package/dist/lib/agent-guides.d.ts +3 -5
- package/dist/lib/agent-guides.js +12 -13
- package/dist/lib/agent-runs.d.ts +69 -9
- package/dist/lib/agent-runs.js +208 -35
- package/dist/lib/agentic-stream.d.ts +12 -0
- package/dist/lib/agentic-stream.js +163 -79
- package/dist/lib/api-fetch.d.ts +2 -0
- package/dist/lib/api-fetch.js +6 -1
- package/dist/lib/command-manifest.d.ts +1 -6
- package/dist/lib/command-manifest.js +86 -13
- package/dist/lib/config.d.ts +2 -3
- package/dist/lib/config.js +2 -3
- package/dist/lib/duties.d.ts +5 -1
- package/dist/lib/duties.js +4 -0
- package/dist/lib/execution-history.d.ts +3 -0
- package/dist/lib/format.d.ts +1 -0
- package/dist/lib/format.js +18 -0
- package/dist/lib/guide-pointer.d.ts +5 -1
- package/dist/lib/guide-pointer.js +21 -2
- package/dist/lib/hosted-job-status.d.ts +4 -0
- package/dist/lib/hosted-job-status.js +19 -0
- package/dist/lib/inbound-messages.d.ts +1 -0
- package/dist/lib/inbound-messages.js +2 -0
- package/dist/lib/roles.d.ts +2 -2
- package/dist/lib/schedule.d.ts +4 -0
- package/dist/lib/schedule.js +4 -3
- package/dist/lib/task-execution.d.ts +1 -1
- package/dist/lib/task-execution.js +3 -19
- package/dist/lib/task-extras.d.ts +11 -1
- package/dist/lib/task-extras.js +15 -1
- package/dist/lib/task-transcript.js +3 -8
- package/dist/lib/triggers.d.ts +5 -36
- package/dist/lib/triggers.js +48 -33
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.d.ts +37 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.js +59 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.d.ts +37 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.js +57 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +12261 -12172
- package/docs/v1/quickstart.md +18 -0
- package/oclif.manifest.json +2505 -629
- package/package.json +3 -2
- package/skills/skrr/SKILL.md +14 -0
- package/dist/commands/triggers/runs.d.ts +0 -22
- package/dist/commands/triggers/runs.js +0 -58
|
@@ -38,6 +38,7 @@ const dpop_auth_1 = require("./dpop-auth");
|
|
|
38
38
|
const SQUASH_RE = /\s+/g;
|
|
39
39
|
const HANDLE_PERMISSION_RE = /^y(es)?$/i;
|
|
40
40
|
const TO_WEB_SOCKET_ORIGIN_RE = /\/$/;
|
|
41
|
+
const CLOUD_STREAM_RESET_NOTICE = 'cloud-stream-reset';
|
|
41
42
|
/**
|
|
42
43
|
* Why a question was dismissed when no terminal exists to ask it on. It is the
|
|
43
44
|
* REASON for a dismissal, never an answer: it travels as the value of the
|
|
@@ -694,7 +695,10 @@ function projectSessionNotices(envelopes) {
|
|
|
694
695
|
const out = [];
|
|
695
696
|
for (const envelope of envelopes) {
|
|
696
697
|
const ev = envelope?.ev;
|
|
697
|
-
if (ev?.t !== 'service' ||
|
|
698
|
+
if (ev?.t !== 'service' ||
|
|
699
|
+
typeof ev.notice !== 'string' ||
|
|
700
|
+
ev.notice === CLOUD_STREAM_RESET_NOTICE ||
|
|
701
|
+
typeof ev.text !== 'string') {
|
|
698
702
|
continue;
|
|
699
703
|
}
|
|
700
704
|
out.push({ type: 'session.notice', notice: ev.notice, message: ev.text });
|
|
@@ -849,6 +853,8 @@ class AgenticStreamClient {
|
|
|
849
853
|
// Envelope keys already applied, so a re-delivered `session:output` frame is
|
|
850
854
|
// not appended twice (OSK-4834). Cleared on `execution:stream-reset`.
|
|
851
855
|
seenEnvelopes = new Set();
|
|
856
|
+
/** Durable reset IDs observed on this response's exact session stream. */
|
|
857
|
+
canonicalResetIds = new Set();
|
|
852
858
|
/**
|
|
853
859
|
* Lifecycle events already emitted, by their own identity (OSK-7632/7689/7709).
|
|
854
860
|
*
|
|
@@ -913,6 +919,7 @@ class AgenticStreamClient {
|
|
|
913
919
|
/** Releases a connect wait still in flight; `close()` calls it. */
|
|
914
920
|
abandonConnectWait = null;
|
|
915
921
|
reconciling = false;
|
|
922
|
+
admittedResponseMessageId;
|
|
916
923
|
responseMessageId;
|
|
917
924
|
lastEvent;
|
|
918
925
|
/**
|
|
@@ -939,6 +946,9 @@ class AgenticStreamClient {
|
|
|
939
946
|
if (options.fixedCopilotProbe && (options.approveTools || options.input))
|
|
940
947
|
throw new Error('Fixed Copilot probe cannot use blanket or terminal approval');
|
|
941
948
|
this.options = options;
|
|
949
|
+
this.admittedResponseMessageId =
|
|
950
|
+
options.resumeRecordedResponseId || options.admittedResponseMessageId || undefined;
|
|
951
|
+
this.responseMessageId = this.admittedResponseMessageId;
|
|
942
952
|
}
|
|
943
953
|
async run() {
|
|
944
954
|
const result = new Promise((resolve, reject) => {
|
|
@@ -946,7 +956,6 @@ class AgenticStreamClient {
|
|
|
946
956
|
this.reject = reject;
|
|
947
957
|
});
|
|
948
958
|
if (this.options.resumeRecordedResponseId) {
|
|
949
|
-
this.responseMessageId = this.options.resumeRecordedResponseId;
|
|
950
959
|
const hasTerminal = await this.probeTerminal('idempotent_replay');
|
|
951
960
|
if (hasTerminal || this.handover || this.closed)
|
|
952
961
|
return result;
|
|
@@ -1093,6 +1102,8 @@ class AgenticStreamClient {
|
|
|
1093
1102
|
reconciledFrom: 'durable_record',
|
|
1094
1103
|
reason,
|
|
1095
1104
|
...(terminal.error ? { message: terminal.error, error: terminal.error } : {}),
|
|
1105
|
+
...(terminal.code ? { code: terminal.code } : {}),
|
|
1106
|
+
...(terminal.errorType ? { errorType: terminal.errorType } : {}),
|
|
1096
1107
|
...(typeof terminal.text === 'string' ? { result: terminal.text } : {}),
|
|
1097
1108
|
...(terminal.publicProjection ? { publicProjection: terminal.publicProjection } : {}),
|
|
1098
1109
|
};
|
|
@@ -1573,6 +1584,46 @@ class AgenticStreamClient {
|
|
|
1573
1584
|
answerText() {
|
|
1574
1585
|
return (0, widgetTerminalText_1.widgetsAsText)(this.accumulated, { final: false });
|
|
1575
1586
|
}
|
|
1587
|
+
matchesAdmittedResponse(messageId) {
|
|
1588
|
+
return (!this.admittedResponseMessageId ||
|
|
1589
|
+
typeof messageId !== 'string' ||
|
|
1590
|
+
!messageId ||
|
|
1591
|
+
messageId === this.admittedResponseMessageId);
|
|
1592
|
+
}
|
|
1593
|
+
/** Match the binding used by data-provider's canonical retry reducer. */
|
|
1594
|
+
canonicalResetId(event, value) {
|
|
1595
|
+
const env = value;
|
|
1596
|
+
const { sessionId } = this.options;
|
|
1597
|
+
const responseMessageId = this.admittedResponseMessageId;
|
|
1598
|
+
if (env?.ev?.t !== 'service' ||
|
|
1599
|
+
env.ev.notice !== CLOUD_STREAM_RESET_NOTICE ||
|
|
1600
|
+
!responseMessageId ||
|
|
1601
|
+
env.messageId !== responseMessageId ||
|
|
1602
|
+
(event.sessionId ?? env.sessionId) !== sessionId ||
|
|
1603
|
+
(env.sessionId != null && env.sessionId !== sessionId) ||
|
|
1604
|
+
env.role !== 'agent' ||
|
|
1605
|
+
env.subagent ||
|
|
1606
|
+
(env.agentId != null && (typeof env.agentId !== 'string' || !env.agentId)) ||
|
|
1607
|
+
(env.turn !== responseMessageId &&
|
|
1608
|
+
(env.sessionId !== sessionId || env.turn !== `${sessionId}:${responseMessageId}`)) ||
|
|
1609
|
+
typeof env.__seq !== 'number' ||
|
|
1610
|
+
!Number.isSafeInteger(env.__seq) ||
|
|
1611
|
+
env.__seq <= 0 ||
|
|
1612
|
+
typeof env.id !== 'string' ||
|
|
1613
|
+
!env.id)
|
|
1614
|
+
return undefined;
|
|
1615
|
+
return env.id;
|
|
1616
|
+
}
|
|
1617
|
+
resetAttemptOutput() {
|
|
1618
|
+
this.accumulated = '';
|
|
1619
|
+
this.chatReply = undefined;
|
|
1620
|
+
this.publicProjection = undefined;
|
|
1621
|
+
this.textJoiner.reset();
|
|
1622
|
+
this.renderedText = '';
|
|
1623
|
+
this.lastJsonlText = null;
|
|
1624
|
+
this.startedDaemonCalls.clear();
|
|
1625
|
+
this.orphanToolEnd = false;
|
|
1626
|
+
}
|
|
1576
1627
|
applySessionOutput(event) {
|
|
1577
1628
|
// The agent's words arrive HERE for agentic runs, inside `envelopes`, and
|
|
1578
1629
|
// `event.text` is null. Normalising the frame without reading them meant
|
|
@@ -1585,73 +1636,102 @@ class AgenticStreamClient {
|
|
|
1585
1636
|
// chatter in `response`.
|
|
1586
1637
|
// Dedupe re-delivered envelopes (session room + user room + join replay):
|
|
1587
1638
|
// append and reprint only the ones we have not applied yet (OSK-4834).
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
const fresh = unseenEnvelopes(event, this.seenEnvelopes);
|
|
1591
|
-
if (fresh.length === 0)
|
|
1592
|
-
return; // a pure re-delivery — drop it whole
|
|
1593
|
-
const scoped = { ...event, envelopes: fresh };
|
|
1594
|
-
if (fresh.some((env) => env?.ev?.t === 'text' &&
|
|
1595
|
-
env.ev?.publicProjection ===
|
|
1596
|
-
'lookback_answer_v1'))
|
|
1597
|
-
this.publicProjection = 'lookback_answer_v1';
|
|
1598
|
-
// Note what never arrived before folding this batch in (OSK-7631,
|
|
1599
|
-
// OSK-13518). Checked against the FRESH set: a re-delivery carries old
|
|
1600
|
-
// seqs and would read as a gap that never happened.
|
|
1601
|
-
this.noteSeqGap(fresh);
|
|
1602
|
-
this.noteDaemonToolEnvelopes(fresh);
|
|
1603
|
-
// The machine's own turn-end is what the server repairs or settles the
|
|
1604
|
-
// row on; seeing it relayed is the moment the record is about to move.
|
|
1605
|
-
if (this.handover &&
|
|
1606
|
-
fresh.some((env) => env?.ev?.t === 'turn-end')) {
|
|
1607
|
-
this.requestHandoverRead();
|
|
1608
|
-
}
|
|
1609
|
-
for (const envelope of fresh) {
|
|
1610
|
-
const { ev, messageId, subagent } = envelope;
|
|
1611
|
-
if (ev?.t !== 'turn-end' ||
|
|
1612
|
-
ev.status !== 'completed' ||
|
|
1613
|
-
subagent ||
|
|
1614
|
-
(messageId && this.responseMessageId && messageId !== this.responseMessageId))
|
|
1615
|
-
continue;
|
|
1616
|
-
const start = ev.chatReplyStart;
|
|
1617
|
-
if (start === null || (typeof start === 'number' && Number.isSafeInteger(start) && start >= 0)) {
|
|
1618
|
-
this.chatReply = {
|
|
1619
|
-
start,
|
|
1620
|
-
text: ev.responseText ?? '',
|
|
1621
|
-
originalLength: ev.responseTextCut?.originalLength,
|
|
1622
|
-
};
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
const envelopeText = envelopesText(scoped, this.textJoiner, this.accumulated);
|
|
1626
|
-
if (envelopeText) {
|
|
1627
|
-
this.accumulated += envelopeText;
|
|
1628
|
-
this.emit({ ...scoped, type: 'text.delta', text: this.answerText() });
|
|
1629
|
-
}
|
|
1630
|
-
// A daemon-routed turn carries its tool calls HERE and nowhere else.
|
|
1631
|
-
// Projecting them gives both execution paths one vocabulary (OSK-7730).
|
|
1632
|
-
for (const projected of projectDaemonToolEvents(fresh, this.toolNamesByCall)) {
|
|
1633
|
-
this.emitToolEvent({ ...projected, sessionId: this.options.sessionId });
|
|
1634
|
-
}
|
|
1635
|
-
// Notices meant for the person — a local harness that could not resume
|
|
1636
|
-
// its previous session and started a fresh one (OSK-12131). A plain
|
|
1637
|
-
// `service` line is diagnostic chatter and stays in the envelope; one
|
|
1638
|
-
// marked `notice` is said out loud.
|
|
1639
|
-
for (const notice of projectSessionNotices(fresh)) {
|
|
1640
|
-
this.emit({ ...notice, sessionId: this.options.sessionId });
|
|
1641
|
-
}
|
|
1642
|
-
// Who decided each permission request — a person (and where), the
|
|
1643
|
-
// mode, a policy — said beside the decision (OSK-12113).
|
|
1644
|
-
for (const resolved of projectPermissionResolutions(fresh, this.toolNamesByPermission)) {
|
|
1645
|
-
this.emit({ ...resolved, sessionId: this.options.sessionId });
|
|
1646
|
-
}
|
|
1647
|
-
this.emit({ ...scoped, type: 'session.output' });
|
|
1639
|
+
if (!Array.isArray(event.envelopes) || event.envelopes.length === 0) {
|
|
1640
|
+
this.emit({ ...event, type: 'session.output' });
|
|
1648
1641
|
return;
|
|
1649
1642
|
}
|
|
1650
|
-
|
|
1643
|
+
const delivered = unseenEnvelopes(event, this.seenEnvelopes);
|
|
1644
|
+
if (delivered.length === 0)
|
|
1645
|
+
return;
|
|
1646
|
+
let from = 0;
|
|
1647
|
+
for (const [index, envelope] of delivered.entries()) {
|
|
1648
|
+
const resetId = this.canonicalResetId(event, envelope);
|
|
1649
|
+
if (!resetId)
|
|
1650
|
+
continue;
|
|
1651
|
+
this.applySessionEnvelopeBatch(event, delivered.slice(from, index));
|
|
1652
|
+
from = index + 1;
|
|
1653
|
+
if (this.canonicalResetIds.has(resetId))
|
|
1654
|
+
continue;
|
|
1655
|
+
// The marker replaces the answer at this sequence. Replay and raw
|
|
1656
|
+
// output still follow the same session cursor and envelope identities.
|
|
1657
|
+
this.noteSeqGap([envelope]);
|
|
1658
|
+
this.canonicalResetIds.add(resetId);
|
|
1659
|
+
this.resetAttemptOutput();
|
|
1660
|
+
this.emit({
|
|
1661
|
+
type: 'text.reset',
|
|
1662
|
+
sessionId: this.options.sessionId,
|
|
1663
|
+
responseMessageId: this.admittedResponseMessageId,
|
|
1664
|
+
resetId,
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
this.applySessionEnvelopeBatch(event, from === 0 ? delivered : delivered.slice(from));
|
|
1668
|
+
this.emit({ ...event, envelopes: delivered, type: 'session.output' });
|
|
1669
|
+
}
|
|
1670
|
+
applySessionEnvelopeBatch(event, delivered) {
|
|
1671
|
+
if (delivered.length === 0)
|
|
1672
|
+
return;
|
|
1673
|
+
// The session's sequence and raw output include every turn. Use only
|
|
1674
|
+
// this Chat's server-stamped reply envelopes for its answer and tools.
|
|
1675
|
+
this.noteSeqGap(delivered);
|
|
1676
|
+
const fresh = delivered.filter((value) => {
|
|
1677
|
+
const env = value;
|
|
1678
|
+
return env?.role !== 'agent' || this.matchesAdmittedResponse(env.messageId);
|
|
1679
|
+
});
|
|
1680
|
+
const scoped = { ...event, envelopes: fresh };
|
|
1681
|
+
if (fresh.some((env) => env?.ev?.t === 'text' &&
|
|
1682
|
+
env.ev?.publicProjection ===
|
|
1683
|
+
'lookback_answer_v1'))
|
|
1684
|
+
this.publicProjection = 'lookback_answer_v1';
|
|
1685
|
+
this.noteDaemonToolEnvelopes(fresh);
|
|
1686
|
+
// The machine's own turn-end is what the server repairs or settles the
|
|
1687
|
+
// row on; seeing it relayed is the moment the record is about to move.
|
|
1688
|
+
if (this.handover &&
|
|
1689
|
+
fresh.some((env) => env?.ev?.t === 'turn-end')) {
|
|
1690
|
+
this.requestHandoverRead();
|
|
1691
|
+
}
|
|
1692
|
+
for (const envelope of fresh) {
|
|
1693
|
+
const { ev, messageId, subagent } = envelope;
|
|
1694
|
+
if (ev?.t !== 'turn-end' ||
|
|
1695
|
+
ev.status !== 'completed' ||
|
|
1696
|
+
subagent ||
|
|
1697
|
+
(messageId && this.responseMessageId && messageId !== this.responseMessageId))
|
|
1698
|
+
continue;
|
|
1699
|
+
const start = ev.chatReplyStart;
|
|
1700
|
+
if (start === null || (typeof start === 'number' && Number.isSafeInteger(start) && start >= 0)) {
|
|
1701
|
+
this.chatReply = {
|
|
1702
|
+
start,
|
|
1703
|
+
text: ev.responseText ?? '',
|
|
1704
|
+
originalLength: ev.responseTextCut?.originalLength,
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
const envelopeText = envelopesText(scoped, this.textJoiner, this.accumulated);
|
|
1709
|
+
if (envelopeText) {
|
|
1710
|
+
this.accumulated += envelopeText;
|
|
1711
|
+
this.emit({ ...scoped, type: 'text.delta', text: this.answerText() });
|
|
1712
|
+
}
|
|
1713
|
+
// A daemon-routed turn carries its tool calls HERE and nowhere else.
|
|
1714
|
+
// Projecting them gives both execution paths one vocabulary (OSK-7730).
|
|
1715
|
+
for (const projected of projectDaemonToolEvents(fresh, this.toolNamesByCall)) {
|
|
1716
|
+
this.emitToolEvent({ ...projected, sessionId: this.options.sessionId });
|
|
1717
|
+
}
|
|
1718
|
+
// Notices meant for the person — a local harness that could not resume
|
|
1719
|
+
// its previous session and started a fresh one (OSK-12131). A plain
|
|
1720
|
+
// `service` line is diagnostic chatter and stays in the envelope; one
|
|
1721
|
+
// marked `notice` is said out loud.
|
|
1722
|
+
for (const notice of projectSessionNotices(fresh)) {
|
|
1723
|
+
this.emit({ ...notice, sessionId: this.options.sessionId });
|
|
1724
|
+
}
|
|
1725
|
+
// Who decided each permission request — a person (and where), the
|
|
1726
|
+
// mode, a policy — said beside the decision (OSK-12113).
|
|
1727
|
+
for (const resolved of projectPermissionResolutions(fresh, this.toolNamesByPermission)) {
|
|
1728
|
+
this.emit({ ...resolved, sessionId: this.options.sessionId });
|
|
1729
|
+
}
|
|
1651
1730
|
}
|
|
1652
1731
|
installHandlers() {
|
|
1653
1732
|
const socket = this.socket;
|
|
1654
1733
|
const match = (event) => !event.sessionId || event.sessionId === this.options.sessionId;
|
|
1734
|
+
const matchResponse = (event) => match(event) && this.matchesAdmittedResponse(event.responseMessageId);
|
|
1655
1735
|
socket.on('connect', () => {
|
|
1656
1736
|
socket.emit('session:join', this.sessionJoinPayload());
|
|
1657
1737
|
this.emit({ type: 'transport.connected', sessionId: this.options.sessionId });
|
|
@@ -1694,7 +1774,7 @@ class AgenticStreamClient {
|
|
|
1694
1774
|
this.emit({ ...event, type: 'run.started' });
|
|
1695
1775
|
});
|
|
1696
1776
|
socket.on('message:stream', (event) => {
|
|
1697
|
-
if (!match(event))
|
|
1777
|
+
if (!match(event) || !this.matchesAdmittedResponse(event.messageId))
|
|
1698
1778
|
return;
|
|
1699
1779
|
if (event.publicProjection === 'lookback_answer_v1')
|
|
1700
1780
|
this.publicProjection = event.publicProjection;
|
|
@@ -1704,7 +1784,7 @@ class AgenticStreamClient {
|
|
|
1704
1784
|
this.accumulated = text;
|
|
1705
1785
|
else if (delta)
|
|
1706
1786
|
this.accumulated += delta;
|
|
1707
|
-
if (typeof event.messageId === 'string')
|
|
1787
|
+
if (!this.admittedResponseMessageId && typeof event.messageId === 'string')
|
|
1708
1788
|
this.responseMessageId = event.messageId;
|
|
1709
1789
|
this.emit({ ...event, type: 'text.delta', text: this.answerText() });
|
|
1710
1790
|
});
|
|
@@ -1730,21 +1810,20 @@ class AgenticStreamClient {
|
|
|
1730
1810
|
this.emit({ ...event, type: 'run.queued' });
|
|
1731
1811
|
});
|
|
1732
1812
|
socket.on('execution:stream-reset', (event) => {
|
|
1733
|
-
if (!
|
|
1813
|
+
if (!matchResponse(event))
|
|
1734
1814
|
return;
|
|
1735
|
-
this.
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1815
|
+
if (event.sessionId === this.options.sessionId &&
|
|
1816
|
+
event.responseMessageId === this.admittedResponseMessageId &&
|
|
1817
|
+
typeof event.resetId === 'string' &&
|
|
1818
|
+
this.canonicalResetIds.has(event.resetId))
|
|
1819
|
+
return;
|
|
1820
|
+
this.resetAttemptOutput();
|
|
1740
1821
|
// Seqs restart with the stream, so a fresh low seq is not a gap.
|
|
1741
1822
|
this.highestSeq = 0;
|
|
1742
1823
|
this.replayGeneration += 1;
|
|
1743
1824
|
this.pendingEnvelopes.clear();
|
|
1744
1825
|
this.reportedGap = false;
|
|
1745
1826
|
this.lostRanges.length = 0;
|
|
1746
|
-
this.startedDaemonCalls.clear();
|
|
1747
|
-
this.orphanToolEnd = false;
|
|
1748
1827
|
// A reset restarts the stream, so envelope seqs may repeat; forget the
|
|
1749
1828
|
// seen keys or the fresh post-reset text would be deduped away (OSK-4834).
|
|
1750
1829
|
this.seenEnvelopes.clear();
|
|
@@ -1752,7 +1831,7 @@ class AgenticStreamClient {
|
|
|
1752
1831
|
this.emit({ ...event, type: 'text.reset' });
|
|
1753
1832
|
});
|
|
1754
1833
|
socket.on('message:stream-end', (event) => {
|
|
1755
|
-
if (!
|
|
1834
|
+
if (!matchResponse(event))
|
|
1756
1835
|
return;
|
|
1757
1836
|
// Byte-identical repeats, including `endedAt` (OSK-7689). Key on the
|
|
1758
1837
|
// message the stream ended for, falling back to the session.
|
|
@@ -1764,7 +1843,7 @@ class AgenticStreamClient {
|
|
|
1764
1843
|
// hand-over failure through another room, or anything a later writer sends
|
|
1765
1844
|
// — is a reason to read the record, not a verdict of its own (OSK-13543).
|
|
1766
1845
|
socket.on('execution:complete', (event) => {
|
|
1767
|
-
if (!
|
|
1846
|
+
if (!matchResponse(event))
|
|
1768
1847
|
return;
|
|
1769
1848
|
if (this.handover)
|
|
1770
1849
|
this.requestHandoverRead();
|
|
@@ -1772,7 +1851,7 @@ class AgenticStreamClient {
|
|
|
1772
1851
|
this.finish('completed', event);
|
|
1773
1852
|
});
|
|
1774
1853
|
socket.on('execution:aborted', (event) => {
|
|
1775
|
-
if (!
|
|
1854
|
+
if (!matchResponse(event))
|
|
1776
1855
|
return;
|
|
1777
1856
|
if (typeof event.permissionEpoch === 'string' &&
|
|
1778
1857
|
this.permissionEpochs.has(this.options.sessionId) &&
|
|
@@ -1784,7 +1863,7 @@ class AgenticStreamClient {
|
|
|
1784
1863
|
this.finish('aborted', event);
|
|
1785
1864
|
});
|
|
1786
1865
|
socket.on('execution:cancelled', (event) => {
|
|
1787
|
-
if (!
|
|
1866
|
+
if (!matchResponse(event))
|
|
1788
1867
|
return;
|
|
1789
1868
|
if (typeof event.permissionEpoch === 'string' &&
|
|
1790
1869
|
this.permissionEpochs.has(this.options.sessionId) &&
|
|
@@ -1796,7 +1875,7 @@ class AgenticStreamClient {
|
|
|
1796
1875
|
this.finish('aborted', event);
|
|
1797
1876
|
});
|
|
1798
1877
|
socket.on('execution:error', (event) => {
|
|
1799
|
-
if (!
|
|
1878
|
+
if (!matchResponse(event))
|
|
1800
1879
|
return;
|
|
1801
1880
|
if (this.handover)
|
|
1802
1881
|
this.requestHandoverRead();
|
|
@@ -2488,7 +2567,9 @@ class AgenticStreamClient {
|
|
|
2488
2567
|
const previous = this.lastJsonlText;
|
|
2489
2568
|
const text = event.text;
|
|
2490
2569
|
this.lastJsonlText = text;
|
|
2491
|
-
const appended =
|
|
2570
|
+
const appended = previous !== null && text.startsWith(previous)
|
|
2571
|
+
? text.slice(previous.length)
|
|
2572
|
+
: undefined;
|
|
2492
2573
|
if (!this.options.incrementalText) {
|
|
2493
2574
|
return appended === undefined ? event : { ...event, delta: appended };
|
|
2494
2575
|
}
|
|
@@ -2560,6 +2641,9 @@ class AgenticStreamClient {
|
|
|
2560
2641
|
// resolved to on that machine (OSK-12111).
|
|
2561
2642
|
output.write(`[run] model: ${event.harnessModel} (reported by the harness)\n`);
|
|
2562
2643
|
}
|
|
2644
|
+
else if (event.type === 'text.reset') {
|
|
2645
|
+
output.write('\n[retry] Discarding the previous attempt.\n');
|
|
2646
|
+
}
|
|
2563
2647
|
else if (event.type === 'text.delta' && typeof event.text === 'string') {
|
|
2564
2648
|
// Print what is NEW. See `renderableDelta` — the old `\r` repaint could
|
|
2565
2649
|
// not rewind past a newline, so a multi-line answer was reprinted once
|
package/dist/lib/api-fetch.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export interface ApiFetchOptions {
|
|
|
9
9
|
credential?: ResolvedCredential;
|
|
10
10
|
/** Exact history GET on the currently bound Agent session. */
|
|
11
11
|
sessionRead?: 'memory-history-v1' | 'agent-history-v1';
|
|
12
|
+
/** Read in personal scope regardless of the human CLI's ambient workspace. */
|
|
13
|
+
workspaceScope?: 'personal';
|
|
12
14
|
/**
|
|
13
15
|
* Extra request headers. Added for `X-Idempotency-Key` (OSK-2806): the
|
|
14
16
|
* shared data-provider transport takes no per-call options, so a replayed
|
package/dist/lib/api-fetch.js
CHANGED
|
@@ -246,7 +246,12 @@ async function apiFetch(pathOrUrl, opts = {}) {
|
|
|
246
246
|
OVERSKY_AUTONOMOUS_SESSION: '1',
|
|
247
247
|
OVERSKY_SESSION_WORKSPACE_ID: process.env.OVERSKY_SESSION_WORKSPACE_ID,
|
|
248
248
|
}
|
|
249
|
-
:
|
|
249
|
+
: opts.workspaceScope === 'personal'
|
|
250
|
+
? {
|
|
251
|
+
OVERSKY_AUTONOMOUS_SESSION: process.env.OVERSKY_AUTONOMOUS_SESSION,
|
|
252
|
+
OVERSKY_SESSION_WORKSPACE_ID: process.env.OVERSKY_SESSION_WORKSPACE_ID,
|
|
253
|
+
}
|
|
254
|
+
: process.env), url, method);
|
|
250
255
|
// E6: a 429 on a GET or an idempotency-keyed write is retried (bounded,
|
|
251
256
|
// jittered, honouring Retry-After). The last 429's wait is kept for the error.
|
|
252
257
|
let fetched;
|
|
@@ -26,10 +26,5 @@ export declare function manifestPath(rootDir: string): string;
|
|
|
26
26
|
export declare function loadCommandManifest(rootDir: string): CommandManifest;
|
|
27
27
|
export declare function commandKey(command: string): string;
|
|
28
28
|
export declare function visibleCommandEntries(manifest: CommandManifest): VisibleCommandEntry[];
|
|
29
|
-
/**
|
|
30
|
-
* Narrow a command catalog by every word the user supplied. A multi-word
|
|
31
|
-
* discovery query such as "spaces templates" is a concept, not a request for
|
|
32
|
-
* every command containing either generic word. Keeping the matching here
|
|
33
|
-
* also makes the same semantics available to future catalog surfaces.
|
|
34
|
-
*/
|
|
29
|
+
/** Prefer command names and known intents. A match in an example ranks below either. */
|
|
35
30
|
export declare function searchVisibleCommandEntries(entries: VisibleCommandEntry[], query: string | undefined): VisibleCommandEntry[];
|
|
@@ -43,7 +43,55 @@ const fs = __importStar(require("node:fs"));
|
|
|
43
43
|
const path = __importStar(require("node:path"));
|
|
44
44
|
const COMMAND_KEY_RE = /\s+/g;
|
|
45
45
|
const VISIBLE_COMMAND_ENTRIES_RE = /:/g;
|
|
46
|
-
const
|
|
46
|
+
const SEARCH_WORDS = /[\p{L}\p{N}]+/gu;
|
|
47
|
+
const SEARCH_STOP_WORDS = new Set([
|
|
48
|
+
'a',
|
|
49
|
+
'an',
|
|
50
|
+
'am',
|
|
51
|
+
'for',
|
|
52
|
+
'i',
|
|
53
|
+
'in',
|
|
54
|
+
'me',
|
|
55
|
+
'my',
|
|
56
|
+
'of',
|
|
57
|
+
'on',
|
|
58
|
+
'please',
|
|
59
|
+
'the',
|
|
60
|
+
'to',
|
|
61
|
+
]);
|
|
62
|
+
const commandIntents = new Map([
|
|
63
|
+
['context', ['check who I am', 'check write attribution', '检查身份']],
|
|
64
|
+
['tasks:list', ['find a task', 'search tasks by title', 'look up existing tasks', '查找任务']],
|
|
65
|
+
['tasks:show', ['read task details', 'inspect task state', '查看任务']],
|
|
66
|
+
[
|
|
67
|
+
'tasks:complete',
|
|
68
|
+
[
|
|
69
|
+
'finish a task',
|
|
70
|
+
'close out a task',
|
|
71
|
+
'submit for review',
|
|
72
|
+
'submit for independent review',
|
|
73
|
+
'submit result for review',
|
|
74
|
+
'submit result for independent review',
|
|
75
|
+
'send to independent review',
|
|
76
|
+
'完成任务',
|
|
77
|
+
'关闭任务',
|
|
78
|
+
'提交评审',
|
|
79
|
+
'提交审核',
|
|
80
|
+
'提交审阅',
|
|
81
|
+
'提交独立评审',
|
|
82
|
+
'交给独立评审',
|
|
83
|
+
'移交独立评审',
|
|
84
|
+
'送交独立评审',
|
|
85
|
+
],
|
|
86
|
+
],
|
|
87
|
+
['tasks:result:submit', ['submit a result', 'record a result', '提交结果']],
|
|
88
|
+
[
|
|
89
|
+
'tasks:review',
|
|
90
|
+
['request changes', 'return result for changes', '退回补充证据', '要求补充证据'],
|
|
91
|
+
],
|
|
92
|
+
['tasks:updates:add', ['record verification', 'report task progress', '记录验证', '记录进展']],
|
|
93
|
+
['agent:message:list', ['message history', 'previous owner messages', '沟通历史', '聊天记录']],
|
|
94
|
+
]);
|
|
47
95
|
let sourceManifest;
|
|
48
96
|
/** The source launcher supplies the catalog generated from the same commands it runs. */
|
|
49
97
|
function useSourceCommandManifest(root, manifest) {
|
|
@@ -77,20 +125,45 @@ function visibleCommandEntries(manifest) {
|
|
|
77
125
|
examples: command.examples ?? [],
|
|
78
126
|
}));
|
|
79
127
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
128
|
+
function searchWords(text) {
|
|
129
|
+
return (text.normalize('NFKC').toLowerCase().match(SEARCH_WORDS) ?? [])
|
|
130
|
+
.filter((word) => !SEARCH_STOP_WORDS.has(word))
|
|
131
|
+
.map((word) => word.replace(/^(\w{3,}[^s])s$/, '$1'));
|
|
132
|
+
}
|
|
133
|
+
// Chinese requests often put the named action inside a longer unspaced phrase.
|
|
134
|
+
function includesChineseIntent(query, intent) {
|
|
135
|
+
return intent.length >= 4 && /\p{Script=Han}/u.test(intent) && query.includes(intent);
|
|
136
|
+
}
|
|
137
|
+
/** Prefer command names and known intents. A match in an example ranks below either. */
|
|
86
138
|
function searchVisibleCommandEntries(entries, query) {
|
|
87
|
-
|
|
88
|
-
if (terms.length === 0)
|
|
139
|
+
if (!query?.trim())
|
|
89
140
|
return entries;
|
|
90
|
-
|
|
141
|
+
const terms = searchWords(query);
|
|
142
|
+
if (!terms.length)
|
|
143
|
+
return [];
|
|
144
|
+
const exact = terms.join(' ');
|
|
145
|
+
const includesAll = (words) => terms.every((term) => words.includes(term));
|
|
146
|
+
const matches = entries.flatMap((entry) => {
|
|
91
147
|
if (entry.id === 'commands')
|
|
92
|
-
return
|
|
93
|
-
const
|
|
94
|
-
|
|
148
|
+
return [];
|
|
149
|
+
const names = [entry.command, ...entry.aliases].map(searchWords);
|
|
150
|
+
const intents = (commandIntents.get(entry.id) ?? []).map(searchWords);
|
|
151
|
+
const phrases = intents.map((words) => words.join(' '));
|
|
152
|
+
const name = names[0];
|
|
153
|
+
let rank = 0;
|
|
154
|
+
if (names.some((words) => words.join(' ') === exact))
|
|
155
|
+
rank = 5;
|
|
156
|
+
else if (phrases.includes(exact))
|
|
157
|
+
rank = 4;
|
|
158
|
+
else if (names.some(includesAll) ||
|
|
159
|
+
intents.some(includesAll) ||
|
|
160
|
+
phrases.some((phrase) => includesChineseIntent(exact, phrase)))
|
|
161
|
+
rank = 3;
|
|
162
|
+
else if (includesAll([...name, ...searchWords(entry.description)]))
|
|
163
|
+
rank = 2;
|
|
164
|
+
else if (entry.examples.some((example) => includesAll([...name, ...searchWords(example)])))
|
|
165
|
+
rank = 1;
|
|
166
|
+
return rank ? [{ entry, rank }] : [];
|
|
95
167
|
});
|
|
168
|
+
return matches.sort((a, b) => b.rank - a.rank).map(({ entry }) => entry);
|
|
96
169
|
}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -246,9 +246,8 @@ export declare function clearSelectedWorkspaceCache(): void;
|
|
|
246
246
|
/**
|
|
247
247
|
* Publish the durable selection as `OVERSKY_WORKSPACE_ID`, once, at startup.
|
|
248
248
|
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* builder, the offline outbox, and `runtime-context` all already read it.
|
|
249
|
+
* The oclif init hook calls this after selecting the Profile so the header
|
|
250
|
+
* builder, offline outbox and runtime context all see its saved workspace.
|
|
252
251
|
*
|
|
253
252
|
* Only when NOTHING already set it. An explicit `OVERSKY_WORKSPACE_ID=… sky …`
|
|
254
253
|
* outranks a stored preference, and a daemon-spawned child inherits its
|
package/dist/lib/config.js
CHANGED
|
@@ -697,9 +697,8 @@ function clearSelectedWorkspaceCache() {
|
|
|
697
697
|
/**
|
|
698
698
|
* Publish the durable selection as `OVERSKY_WORKSPACE_ID`, once, at startup.
|
|
699
699
|
*
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
* builder, the offline outbox, and `runtime-context` all already read it.
|
|
700
|
+
* The oclif init hook calls this after selecting the Profile so the header
|
|
701
|
+
* builder, offline outbox and runtime context all see its saved workspace.
|
|
703
702
|
*
|
|
704
703
|
* Only when NOTHING already set it. An explicit `OVERSKY_WORKSPACE_ID=… sky …`
|
|
705
704
|
* outranks a stored preference, and a daemon-spawned child inherits its
|
package/dist/lib/duties.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DutyAuthoringSnapshot, type DutyAuthoringWarning, type DutyObservationsQuery, type DutyObservationsResponse } from '@skrr-ai/data-provider';
|
|
1
|
+
import { type DutyAuthoringSnapshot, type DutyAuthoringWarning, type DutyObservationsQuery, type DutyObservationsResponse, type AddAgentDutyCatalogEntryResponse, type AgentDutyCatalogResponse } from '@skrr-ai/data-provider';
|
|
2
2
|
/**
|
|
3
3
|
* duties.ts — request-based client for the Duties subsystem
|
|
4
4
|
* (`/api/duties/*`).
|
|
@@ -350,6 +350,10 @@ export declare const dutyApi: {
|
|
|
350
350
|
* swept, how stale that is, and the tally it last persisted. Aggregate only.
|
|
351
351
|
*/
|
|
352
352
|
livenessSweep: () => Promise<Record<string, unknown>>;
|
|
353
|
+
/** One Agent's Duty catalog: each preconfigured Duty and whether it is on (OSK-33996). */
|
|
354
|
+
catalog: (agentId: string) => Promise<AgentDutyCatalogResponse>;
|
|
355
|
+
/** Add a catalog system role the Agent does not have. Idempotent. */
|
|
356
|
+
addCatalogEntry: (agentId: string, entryId: string) => Promise<AddAgentDutyCatalogEntryResponse>;
|
|
353
357
|
/** One agent's Duties, system roles included, each with its loop status. */
|
|
354
358
|
roster: (agentId: string) => Promise<DutyRoster>;
|
|
355
359
|
/** Is this Duty's loop installed and working. */
|
package/dist/lib/duties.js
CHANGED
|
@@ -230,6 +230,10 @@ exports.dutyApi = {
|
|
|
230
230
|
* swept, how stale that is, and the tally it last persisted. Aggregate only.
|
|
231
231
|
*/
|
|
232
232
|
livenessSweep: () => data_provider_2.request.get('/api/duties/liveness/sweep'),
|
|
233
|
+
/** One Agent's Duty catalog: each preconfigured Duty and whether it is on (OSK-33996). */
|
|
234
|
+
catalog: (agentId) => data_provider_2.request.get(`/api/duties/agents/${encodeURIComponent(agentId)}/catalog`),
|
|
235
|
+
/** Add a catalog system role the Agent does not have. Idempotent. */
|
|
236
|
+
addCatalogEntry: (agentId, entryId) => data_provider_2.request.post(`/api/duties/agents/${encodeURIComponent(agentId)}/catalog/${encodeURIComponent(entryId)}`, {}),
|
|
233
237
|
/** One agent's Duties, system roles included, each with its loop status. */
|
|
234
238
|
roster: (agentId) => data_provider_2.request.get((0, triggers_1.withQuery)('/api/duties/roster', {
|
|
235
239
|
agentId,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AgentRunAttemptLifecycle, AgentRunRuntimeWait } from '@skrr-ai/data-provider';
|
|
1
2
|
export type ExecutionRun = {
|
|
2
3
|
id: string;
|
|
3
4
|
source: string;
|
|
@@ -8,11 +9,13 @@ export type ExecutionRun = {
|
|
|
8
9
|
};
|
|
9
10
|
export type ExecutionRunDetail = ExecutionRun & {
|
|
10
11
|
coverage: 'complete' | 'partial';
|
|
12
|
+
runtimeWait?: Pick<AgentRunRuntimeWait, 'reason' | 'deadlineAt'>;
|
|
11
13
|
attempts: Array<{
|
|
12
14
|
id: string;
|
|
13
15
|
number: number;
|
|
14
16
|
executor: string;
|
|
15
17
|
grantedAt?: string;
|
|
18
|
+
lifecycle?: AgentRunAttemptLifecycle;
|
|
16
19
|
}>;
|
|
17
20
|
};
|
|
18
21
|
export type ExecutionPage<T> = {
|
package/dist/lib/format.d.ts
CHANGED
|
@@ -110,6 +110,7 @@ export declare function localStamp(value: unknown): string;
|
|
|
110
110
|
* activity, monitor) order events seconds apart. Never throws.
|
|
111
111
|
*/
|
|
112
112
|
export declare function localTime(value: unknown): string;
|
|
113
|
+
export declare function formatDurationMs(value: unknown): string;
|
|
113
114
|
/**
|
|
114
115
|
* `PDT` — the zone `localStamp` renders in, to be named once per command
|
|
115
116
|
* rather than repeated on every row.
|
package/dist/lib/format.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.collapseWhitespace = collapseWhitespace;
|
|
|
10
10
|
exports.renderTable = renderTable;
|
|
11
11
|
exports.localStamp = localStamp;
|
|
12
12
|
exports.localTime = localTime;
|
|
13
|
+
exports.formatDurationMs = formatDurationMs;
|
|
13
14
|
exports.localZone = localZone;
|
|
14
15
|
exports.zoneAbbreviation = zoneAbbreviation;
|
|
15
16
|
exports.zonedTime = zonedTime;
|
|
@@ -313,6 +314,23 @@ function localTime(value) {
|
|
|
313
314
|
const seconds = `${date.getSeconds()}`.padStart(2, '0');
|
|
314
315
|
return `${localStamp(date)}:${seconds}${zone ? ` ${zone}` : ''}`;
|
|
315
316
|
}
|
|
317
|
+
function formatDurationMs(value) {
|
|
318
|
+
const ms = Number(value);
|
|
319
|
+
if (!Number.isFinite(ms) || ms < 0)
|
|
320
|
+
return '-';
|
|
321
|
+
if (ms < 1000)
|
|
322
|
+
return `${Math.floor(ms)}ms`;
|
|
323
|
+
const seconds = Math.floor(ms / 1000);
|
|
324
|
+
if (seconds < 60)
|
|
325
|
+
return `${seconds}s`;
|
|
326
|
+
const minutes = Math.floor(seconds / 60);
|
|
327
|
+
if (minutes < 60)
|
|
328
|
+
return `${minutes}m${seconds % 60 ? `${seconds % 60}s` : ''}`;
|
|
329
|
+
const hours = Math.floor(minutes / 60);
|
|
330
|
+
if (hours < 48)
|
|
331
|
+
return `${hours}h${minutes % 60 ? `${minutes % 60}m` : ''}`;
|
|
332
|
+
return `${Math.floor(hours / 24)}d`;
|
|
333
|
+
}
|
|
316
334
|
/**
|
|
317
335
|
* `PDT` — the zone `localStamp` renders in, to be named once per command
|
|
318
336
|
* rather than repeated on every row.
|