@lobu/runtime-device 21.2.1 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component.json +1 -1
- package/dist/dependencies.bun.lock +91 -83
- package/npm-shrinkwrap.json +492 -438
- package/package.json +12 -2
- package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +5 -6
- package/vendor/cli/dist/commands/_lib/apply/client.d.ts +1 -0
- package/vendor/cli/dist/commands/_lib/apply/client.js +26 -7
- package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +9 -1
- package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +1 -0
- package/vendor/cli/dist/commands/_lib/apply/diff.js +46 -4
- package/vendor/cli/dist/commands/_lib/apply/map-config.js +18 -38
- package/vendor/cli/dist/commands/_lib/init-from-org/bootstrap.js +5 -17
- package/vendor/cli/dist/commands/init.d.ts +0 -2
- package/vendor/cli/dist/commands/init.js +0 -27
- package/vendor/cli/dist/commands/login.d.ts +17 -0
- package/vendor/cli/dist/commands/login.js +43 -17
- package/vendor/cli/dist/commands/memory/_lib/errors.d.ts +0 -8
- package/vendor/cli/dist/commands/memory/_lib/errors.js +0 -12
- package/vendor/cli/dist/commands/memory/_lib/mcp.js +6 -6
- package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +4 -10
- package/vendor/cli/dist/config/define.d.ts +21 -15
- package/vendor/cli/dist/config/define.js +2 -2
- package/vendor/cli/dist/connectors/README.md +7 -5
- package/vendor/cli/dist/connectors/_google/actions.ts +270 -0
- package/vendor/cli/dist/connectors/_google/discovery/calendar_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/chat_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/docs_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/drive_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/gmail_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/people_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/sheets_v4.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/tasks_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/youtube_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery.ts +442 -0
- package/vendor/cli/dist/connectors/_google/errors.ts +91 -0
- package/vendor/cli/dist/connectors/_google/list-feed.ts +223 -0
- package/vendor/cli/dist/connectors/_google/policies.ts +127 -0
- package/vendor/cli/dist/connectors/agentid.ts +43 -0
- package/vendor/cli/dist/connectors/chat-user-identity.ts +2 -1
- package/vendor/cli/dist/connectors/github-automation-events.ts +9 -0
- package/vendor/cli/dist/connectors/github-identity.ts +28 -3
- package/vendor/cli/dist/connectors/github.ts +101 -59
- package/vendor/cli/dist/connectors/google_calendar.ts +207 -719
- package/vendor/cli/dist/connectors/google_drive.ts +16 -2
- package/vendor/cli/dist/connectors/google_gmail.ts +51 -33
- package/vendor/cli/dist/connectors/herdr.ts +406 -0
- package/vendor/cli/dist/connectors/jira.ts +6 -6
- package/vendor/cli/dist/connectors/linear.ts +7 -4
- package/vendor/cli/dist/connectors/postgres.ts +27 -2
- package/vendor/cli/dist/connectors/tiktok-inbox-page.js +230 -0
- package/vendor/cli/dist/connectors/tiktok-web-page.js +211 -0
- package/vendor/cli/dist/connectors/tiktok_web.ts +286 -0
- package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +228 -10
- package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +47 -14
- package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +121 -0
- package/vendor/cli/dist/connectors/whatsapp_web.ts +170 -29
- package/vendor/cli/dist/connectors/x.ts +276 -136
- package/vendor/cli/dist/index.js +1 -37
- package/vendor/cli/dist/internal/context.d.ts +10 -0
- package/vendor/cli/dist/internal/context.js +26 -16
- package/vendor/cli/dist/internal/node-version.d.ts +1 -1
- package/vendor/cli/dist/internal/node-version.js +1 -1
- package/vendor/cli/dist/internal/oauth.d.ts +3 -1
- package/vendor/cli/dist/internal/oauth.js +4 -3
- package/vendor/cli/dist/internal/runtime-components.d.ts +9 -0
- package/vendor/cli/dist/internal/runtime-components.js +67 -2
- package/vendor/cli/dist/mac-auth.js +17 -1
- package/vendor/cli/dist/providers.json +1 -1
- package/vendor/cli/dist/runtime-components.json +4 -4
- package/vendor/cli/dist/templates/AGENTS.md.tmpl +11 -4
- package/vendor/cli/dist/templates/README.md.tmpl +1 -1
- package/vendor/cli/dist/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
- package/vendor/cli/dist/vendor/ora/index.d.ts +332 -0
- package/vendor/cli/dist/vendor/ora/index.js +424 -0
- package/vendor/cli/dist/vendor/ora/license +9 -0
- package/vendor/cli/dist/vendor/ora/package.json +64 -0
- package/vendor/cli/dist/vendor/ora/readme.md +329 -0
- package/vendor/cli/package.json +2 -2
- package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
- package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
- package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
- package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
- package/vendor/connector-sdk/dist/connector-types.d.ts +159 -45
- package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
- package/vendor/connector-sdk/dist/define-connector.js +3 -0
- package/vendor/connector-sdk/dist/index.d.ts +5 -2
- package/vendor/connector-sdk/dist/index.js +1 -0
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
- package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
- package/vendor/connector-sdk/package.json +5 -1
- package/vendor/connector-worker/dist/agent-turn/guest-entry.js +31 -27
- package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +131 -185
- package/vendor/connector-worker/dist/agent-turn/memory.d.ts +3 -2
- package/vendor/connector-worker/dist/agent-turn/memory.js +3 -20
- package/vendor/connector-worker/dist/agent-turn/types.d.ts +3 -15
- package/vendor/connector-worker/dist/agent-turn/workspace.d.ts +2 -2
- package/vendor/connector-worker/dist/agent-turn/workspace.js +2 -4
- package/vendor/connector-worker/dist/daemon/action-monitor.d.ts +12 -0
- package/vendor/connector-worker/dist/daemon/action-monitor.js +25 -0
- package/vendor/connector-worker/dist/daemon/agent-turn.js +0 -9
- package/vendor/connector-worker/dist/daemon/builtins/index.d.ts +12 -0
- package/vendor/connector-worker/dist/daemon/builtins/index.js +61 -1
- package/vendor/connector-worker/dist/daemon/builtins/os-shell.d.ts +2 -1
- package/vendor/connector-worker/dist/daemon/builtins/os-shell.js +40 -27
- package/vendor/connector-worker/dist/daemon/client.d.ts +5 -1
- package/vendor/connector-worker/dist/daemon/client.js +3 -0
- package/vendor/connector-worker/dist/daemon/device-concurrency.d.ts +8 -0
- package/vendor/connector-worker/dist/daemon/device-concurrency.js +13 -0
- package/vendor/connector-worker/dist/daemon/executor.d.ts +1 -1
- package/vendor/connector-worker/dist/daemon/executor.js +48 -117
- package/vendor/connector-worker/dist/daemon/log.d.ts +2 -0
- package/vendor/connector-worker/dist/daemon/log.js +23 -2
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +20 -4
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +53 -13
- package/vendor/connector-worker/dist/daemon/native-bridge/client.d.ts +6 -0
- package/vendor/connector-worker/dist/daemon/native-bridge/client.js +15 -0
- package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +2 -0
- package/vendor/connector-worker/dist/daemon/native-bridge/protocol.d.ts +1 -1
- package/vendor/connector-worker/dist/daemon/native-bridge/protocol.js +1 -0
- package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +3 -0
- package/vendor/connector-worker/dist/daemon/poll-loop.js +5 -1
- package/vendor/connector-worker/dist/daemon/start.d.ts +1 -0
- package/vendor/connector-worker/dist/daemon/start.js +12 -5
- package/vendor/connector-worker/dist/executor/interface.d.ts +34 -2
- package/vendor/connector-worker/dist/executor/isolate.js +66 -15
- package/vendor/connector-worker/dist/executor/redact.d.ts +1 -0
- package/vendor/connector-worker/dist/executor/redact.js +97 -26
- package/vendor/connector-worker/dist/executor/runtime.d.ts +7 -0
- package/vendor/connector-worker/dist/executor/runtime.js +26 -0
- package/vendor/connector-worker/dist/isolate/bridge.js +3 -1
- package/vendor/connector-worker/dist/mac-device-daemon.js +10 -3
- package/vendor/connector-worker/package.json +2 -2
- package/vendor/core/dist/agent-policy.js +1 -1
- package/vendor/core/dist/agent-store.d.ts +2 -0
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +1 -1
- package/vendor/core/dist/capabilities.js +2 -0
- package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
- package/vendor/core/dist/contracts/agent-settings.js +1 -7
- package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
- package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
- package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
- package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
- package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
- package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
- package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
- package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
- package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
- package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
- package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
- package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
- package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
- package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
- package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
- package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
- package/vendor/core/dist/contracts/worker/protocol.d.ts +122 -28
- package/vendor/core/dist/contracts/worker/protocol.js +81 -17
- package/vendor/core/dist/index.d.ts +3 -4
- package/vendor/core/dist/index.js +3 -6
- package/vendor/core/dist/json-template.d.ts +6 -10
- package/vendor/core/dist/json-template.js +5 -9
- package/vendor/core/dist/logger.js +11 -5
- package/vendor/core/dist/shell-safety.d.ts +9 -0
- package/vendor/core/dist/shell-safety.js +154 -0
- package/vendor/core/dist/suggestions.d.ts +1 -1
- package/vendor/core/dist/suggestions.js +1 -1
- package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
- package/vendor/core/dist/tool-trace-summary.js +1 -1
- package/vendor/core/dist/types.d.ts +1 -3
- package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
- package/vendor/core/dist/utils/{sentry-scrubber.js → diagnostic-scrubber.js} +25 -53
- package/vendor/core/dist/worker/auth.d.ts +44 -6
- package/vendor/core/dist/worker/auth.js +44 -11
- package/vendor/core/package.json +15 -6
- package/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
- package/vendor/ora/index.d.ts +332 -0
- package/vendor/ora/index.js +424 -0
- package/vendor/ora/license +9 -0
- package/vendor/ora/package.json +53 -0
- package/vendor/ora/readme.md +329 -0
- package/vendor/cli/dist/commands/telemetry.d.ts +0 -10
- package/vendor/cli/dist/commands/telemetry.js +0 -66
- package/vendor/core/dist/sentry.d.ts +0 -26
- package/vendor/core/dist/sentry.js +0 -133
- package/vendor/core/dist/tool-policy.d.ts +0 -74
- package/vendor/core/dist/tool-policy.js +0 -305
- package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import cliCursor from 'cli-cursor';
|
|
4
|
+
import cliSpinners from 'cli-spinners';
|
|
5
|
+
import logSymbols from 'log-symbols';
|
|
6
|
+
import stripAnsi from 'strip-ansi';
|
|
7
|
+
import stringWidth from 'string-width';
|
|
8
|
+
import isInteractive from 'is-interactive';
|
|
9
|
+
import isUnicodeSupported from 'is-unicode-supported';
|
|
10
|
+
import stdinDiscarder from 'stdin-discarder';
|
|
11
|
+
|
|
12
|
+
class Ora {
|
|
13
|
+
#linesToClear = 0;
|
|
14
|
+
#isDiscardingStdin = false;
|
|
15
|
+
#lineCount = 0;
|
|
16
|
+
#frameIndex = -1;
|
|
17
|
+
#lastSpinnerFrameTime = 0;
|
|
18
|
+
#options;
|
|
19
|
+
#spinner;
|
|
20
|
+
#stream;
|
|
21
|
+
#id;
|
|
22
|
+
#initialInterval;
|
|
23
|
+
#isEnabled;
|
|
24
|
+
#isSilent;
|
|
25
|
+
#indent;
|
|
26
|
+
#text;
|
|
27
|
+
#prefixText;
|
|
28
|
+
#suffixText;
|
|
29
|
+
color;
|
|
30
|
+
|
|
31
|
+
constructor(options) {
|
|
32
|
+
if (typeof options === 'string') {
|
|
33
|
+
options = {
|
|
34
|
+
text: options,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
this.#options = {
|
|
39
|
+
color: 'cyan',
|
|
40
|
+
stream: process.stderr,
|
|
41
|
+
discardStdin: true,
|
|
42
|
+
hideCursor: true,
|
|
43
|
+
...options,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Public
|
|
47
|
+
this.color = this.#options.color;
|
|
48
|
+
|
|
49
|
+
// It's important that these use the public setters.
|
|
50
|
+
this.spinner = this.#options.spinner;
|
|
51
|
+
|
|
52
|
+
this.#initialInterval = this.#options.interval;
|
|
53
|
+
this.#stream = this.#options.stream;
|
|
54
|
+
this.#isEnabled = typeof this.#options.isEnabled === 'boolean' ? this.#options.isEnabled : isInteractive({stream: this.#stream});
|
|
55
|
+
this.#isSilent = typeof this.#options.isSilent === 'boolean' ? this.#options.isSilent : false;
|
|
56
|
+
|
|
57
|
+
// Set *after* `this.#stream`.
|
|
58
|
+
// It's important that these use the public setters.
|
|
59
|
+
this.text = this.#options.text;
|
|
60
|
+
this.prefixText = this.#options.prefixText;
|
|
61
|
+
this.suffixText = this.#options.suffixText;
|
|
62
|
+
this.indent = this.#options.indent;
|
|
63
|
+
|
|
64
|
+
if (process.env.NODE_ENV === 'test') {
|
|
65
|
+
this._stream = this.#stream;
|
|
66
|
+
this._isEnabled = this.#isEnabled;
|
|
67
|
+
|
|
68
|
+
Object.defineProperty(this, '_linesToClear', {
|
|
69
|
+
get() {
|
|
70
|
+
return this.#linesToClear;
|
|
71
|
+
},
|
|
72
|
+
set(newValue) {
|
|
73
|
+
this.#linesToClear = newValue;
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
Object.defineProperty(this, '_frameIndex', {
|
|
78
|
+
get() {
|
|
79
|
+
return this.#frameIndex;
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
Object.defineProperty(this, '_lineCount', {
|
|
84
|
+
get() {
|
|
85
|
+
return this.#lineCount;
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get indent() {
|
|
92
|
+
return this.#indent;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
set indent(indent = 0) {
|
|
96
|
+
if (!(indent >= 0 && Number.isInteger(indent))) {
|
|
97
|
+
throw new Error('The `indent` option must be an integer from 0 and up');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this.#indent = indent;
|
|
101
|
+
this.#updateLineCount();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get interval() {
|
|
105
|
+
return this.#initialInterval ?? this.#spinner.interval ?? 100;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
get spinner() {
|
|
109
|
+
return this.#spinner;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
set spinner(spinner) {
|
|
113
|
+
this.#frameIndex = -1;
|
|
114
|
+
this.#initialInterval = undefined;
|
|
115
|
+
|
|
116
|
+
if (typeof spinner === 'object') {
|
|
117
|
+
if (spinner.frames === undefined) {
|
|
118
|
+
throw new Error('The given spinner must have a `frames` property');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.#spinner = spinner;
|
|
122
|
+
} else if (!isUnicodeSupported()) {
|
|
123
|
+
this.#spinner = cliSpinners.line;
|
|
124
|
+
} else if (spinner === undefined) {
|
|
125
|
+
// Set default spinner
|
|
126
|
+
this.#spinner = cliSpinners.dots;
|
|
127
|
+
} else if (spinner !== 'default' && cliSpinners[spinner]) {
|
|
128
|
+
this.#spinner = cliSpinners[spinner];
|
|
129
|
+
} else {
|
|
130
|
+
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
get text() {
|
|
135
|
+
return this.#text;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
set text(value = '') {
|
|
139
|
+
this.#text = value;
|
|
140
|
+
this.#updateLineCount();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
get prefixText() {
|
|
144
|
+
return this.#prefixText;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
set prefixText(value = '') {
|
|
148
|
+
this.#prefixText = value;
|
|
149
|
+
this.#updateLineCount();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
get suffixText() {
|
|
153
|
+
return this.#suffixText;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
set suffixText(value = '') {
|
|
157
|
+
this.#suffixText = value;
|
|
158
|
+
this.#updateLineCount();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
get isSpinning() {
|
|
162
|
+
return this.#id !== undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
#getFullPrefixText(prefixText = this.#prefixText, postfix = ' ') {
|
|
166
|
+
if (typeof prefixText === 'string' && prefixText !== '') {
|
|
167
|
+
return prefixText + postfix;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (typeof prefixText === 'function') {
|
|
171
|
+
return prefixText() + postfix;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return '';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#getFullSuffixText(suffixText = this.#suffixText, prefix = ' ') {
|
|
178
|
+
if (typeof suffixText === 'string' && suffixText !== '') {
|
|
179
|
+
return prefix + suffixText;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (typeof suffixText === 'function') {
|
|
183
|
+
return prefix + suffixText();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return '';
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
#updateLineCount() {
|
|
190
|
+
const columns = this.#stream.columns || 80;
|
|
191
|
+
const fullPrefixText = this.#getFullPrefixText(this.#prefixText, '-');
|
|
192
|
+
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, '-');
|
|
193
|
+
const fullText = ' '.repeat(this.#indent) + fullPrefixText + '--' + this.#text + '--' + fullSuffixText;
|
|
194
|
+
|
|
195
|
+
this.#lineCount = 0;
|
|
196
|
+
for (const line of stripAnsi(fullText).split('\n')) {
|
|
197
|
+
this.#lineCount += Math.max(1, Math.ceil(stringWidth(line, {countAnsiEscapeCodes: true}) / columns));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
get isEnabled() {
|
|
202
|
+
return this.#isEnabled && !this.#isSilent;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
set isEnabled(value) {
|
|
206
|
+
if (typeof value !== 'boolean') {
|
|
207
|
+
throw new TypeError('The `isEnabled` option must be a boolean');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.#isEnabled = value;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
get isSilent() {
|
|
214
|
+
return this.#isSilent;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
set isSilent(value) {
|
|
218
|
+
if (typeof value !== 'boolean') {
|
|
219
|
+
throw new TypeError('The `isSilent` option must be a boolean');
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
this.#isSilent = value;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
frame() {
|
|
226
|
+
// Ensure we only update the spinner frame at the wanted interval,
|
|
227
|
+
// even if the render method is called more often.
|
|
228
|
+
const now = Date.now();
|
|
229
|
+
if (this.#frameIndex === -1 || now - this.#lastSpinnerFrameTime >= this.interval) {
|
|
230
|
+
this.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;
|
|
231
|
+
this.#lastSpinnerFrameTime = now;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const {frames} = this.#spinner;
|
|
235
|
+
let frame = frames[this.#frameIndex];
|
|
236
|
+
|
|
237
|
+
if (this.color) {
|
|
238
|
+
frame = chalk[this.color](frame);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const fullPrefixText = (typeof this.#prefixText === 'string' && this.#prefixText !== '') ? this.#prefixText + ' ' : '';
|
|
242
|
+
const fullText = typeof this.text === 'string' ? ' ' + this.text : '';
|
|
243
|
+
const fullSuffixText = (typeof this.#suffixText === 'string' && this.#suffixText !== '') ? ' ' + this.#suffixText : '';
|
|
244
|
+
|
|
245
|
+
return fullPrefixText + frame + fullText + fullSuffixText;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
clear() {
|
|
249
|
+
if (!this.#isEnabled || !this.#stream.isTTY) {
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
this.#stream.cursorTo(0);
|
|
254
|
+
|
|
255
|
+
for (let index = 0; index < this.#linesToClear; index++) {
|
|
256
|
+
if (index > 0) {
|
|
257
|
+
this.#stream.moveCursor(0, -1);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
this.#stream.clearLine(1);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (this.#indent || this.lastIndent !== this.#indent) {
|
|
264
|
+
this.#stream.cursorTo(this.#indent);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
this.lastIndent = this.#indent;
|
|
268
|
+
this.#linesToClear = 0;
|
|
269
|
+
|
|
270
|
+
return this;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
render() {
|
|
274
|
+
if (this.#isSilent) {
|
|
275
|
+
return this;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
this.clear();
|
|
279
|
+
this.#stream.write(this.frame());
|
|
280
|
+
this.#linesToClear = this.#lineCount;
|
|
281
|
+
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
start(text) {
|
|
286
|
+
if (text) {
|
|
287
|
+
this.text = text;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (this.#isSilent) {
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (!this.#isEnabled) {
|
|
295
|
+
if (this.text) {
|
|
296
|
+
this.#stream.write(`- ${this.text}\n`);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return this;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (this.isSpinning) {
|
|
303
|
+
return this;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (this.#options.hideCursor) {
|
|
307
|
+
cliCursor.hide(this.#stream);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (this.#options.discardStdin && process.stdin.isTTY) {
|
|
311
|
+
this.#isDiscardingStdin = true;
|
|
312
|
+
stdinDiscarder.start();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
this.render();
|
|
316
|
+
this.#id = setInterval(this.render.bind(this), this.interval);
|
|
317
|
+
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
stop() {
|
|
322
|
+
if (!this.#isEnabled) {
|
|
323
|
+
return this;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
clearInterval(this.#id);
|
|
327
|
+
this.#id = undefined;
|
|
328
|
+
this.#frameIndex = 0;
|
|
329
|
+
this.clear();
|
|
330
|
+
if (this.#options.hideCursor) {
|
|
331
|
+
cliCursor.show(this.#stream);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (this.#options.discardStdin && process.stdin.isTTY && this.#isDiscardingStdin) {
|
|
335
|
+
stdinDiscarder.stop();
|
|
336
|
+
this.#isDiscardingStdin = false;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return this;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
succeed(text) {
|
|
343
|
+
return this.stopAndPersist({symbol: logSymbols.success, text});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
fail(text) {
|
|
347
|
+
return this.stopAndPersist({symbol: logSymbols.error, text});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
warn(text) {
|
|
351
|
+
return this.stopAndPersist({symbol: logSymbols.warning, text});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
info(text) {
|
|
355
|
+
return this.stopAndPersist({symbol: logSymbols.info, text});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
stopAndPersist(options = {}) {
|
|
359
|
+
if (this.#isSilent) {
|
|
360
|
+
return this;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const prefixText = options.prefixText ?? this.#prefixText;
|
|
364
|
+
const fullPrefixText = this.#getFullPrefixText(prefixText, ' ');
|
|
365
|
+
|
|
366
|
+
const symbolText = options.symbol ?? ' ';
|
|
367
|
+
|
|
368
|
+
const text = options.text ?? this.text;
|
|
369
|
+
const separatorText = symbolText ? ' ' : '';
|
|
370
|
+
const fullText = (typeof text === 'string') ? separatorText + text : '';
|
|
371
|
+
|
|
372
|
+
const suffixText = options.suffixText ?? this.#suffixText;
|
|
373
|
+
const fullSuffixText = this.#getFullSuffixText(suffixText, ' ');
|
|
374
|
+
|
|
375
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + '\n';
|
|
376
|
+
|
|
377
|
+
this.stop();
|
|
378
|
+
this.#stream.write(textToWrite);
|
|
379
|
+
|
|
380
|
+
return this;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export default function ora(options) {
|
|
385
|
+
return new Ora(options);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export async function oraPromise(action, options) {
|
|
389
|
+
const actionIsFunction = typeof action === 'function';
|
|
390
|
+
const actionIsPromise = typeof action.then === 'function';
|
|
391
|
+
|
|
392
|
+
if (!actionIsFunction && !actionIsPromise) {
|
|
393
|
+
throw new TypeError('Parameter `action` must be a Function or a Promise');
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const {successText, failText} = typeof options === 'object'
|
|
397
|
+
? options
|
|
398
|
+
: {successText: undefined, failText: undefined};
|
|
399
|
+
|
|
400
|
+
const spinner = ora(options).start();
|
|
401
|
+
|
|
402
|
+
try {
|
|
403
|
+
const promise = actionIsFunction ? action(spinner) : action;
|
|
404
|
+
const result = await promise;
|
|
405
|
+
|
|
406
|
+
spinner.succeed(
|
|
407
|
+
successText === undefined
|
|
408
|
+
? undefined
|
|
409
|
+
: (typeof successText === 'string' ? successText : successText(result)),
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
return result;
|
|
413
|
+
} catch (error) {
|
|
414
|
+
spinner.fail(
|
|
415
|
+
failText === undefined
|
|
416
|
+
? undefined
|
|
417
|
+
: (typeof failText === 'string' ? failText : failText(error)),
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
throw error;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export {default as spinners} from 'cli-spinners';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ora",
|
|
3
|
+
"version": "8.2.0",
|
|
4
|
+
"description": "Elegant terminal spinner",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/ora",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Sindre Sorhus",
|
|
10
|
+
"email": "sindresorhus@gmail.com",
|
|
11
|
+
"url": "https://sindresorhus.com"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"index.js",
|
|
24
|
+
"index.d.ts"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"cli",
|
|
28
|
+
"spinner",
|
|
29
|
+
"spinners",
|
|
30
|
+
"terminal",
|
|
31
|
+
"term",
|
|
32
|
+
"console",
|
|
33
|
+
"ascii",
|
|
34
|
+
"unicode",
|
|
35
|
+
"loading",
|
|
36
|
+
"indicator",
|
|
37
|
+
"progress",
|
|
38
|
+
"busy",
|
|
39
|
+
"wait",
|
|
40
|
+
"idle"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"chalk": "^5.3.0",
|
|
44
|
+
"cli-cursor": "^5.0.0",
|
|
45
|
+
"cli-spinners": "^2.9.2",
|
|
46
|
+
"is-interactive": "^2.0.0",
|
|
47
|
+
"is-unicode-supported": "^2.0.0",
|
|
48
|
+
"log-symbols": "^6.0.0",
|
|
49
|
+
"stdin-discarder": "^0.2.2",
|
|
50
|
+
"string-width": "^7.2.0",
|
|
51
|
+
"strip-ansi": "^7.1.0"
|
|
52
|
+
}
|
|
53
|
+
}
|