omnara 0.5.3 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -10
- package/bin/omnara.js +56 -17
- package/package.json +24 -55
- package/dist/auth/auth-provider.d.ts +0 -26
- package/dist/auth/cli-auth-service.d.ts +0 -26
- package/dist/auth/credential-manager.d.ts +0 -13
- package/dist/auth/credentials-store.d.ts +0 -20
- package/dist/auth/ensure-cli-credentials.d.ts +0 -8
- package/dist/auth/login-flow.d.ts +0 -11
- package/dist/auth/loopback-listener.d.ts +0 -20
- package/dist/auth/pkce.d.ts +0 -6
- package/dist/cli.d.ts +0 -3
- package/dist/cli.js +0 -19186
- package/dist/cli.js.map +0 -7
- package/dist/commands/agent.d.ts +0 -9
- package/dist/commands/auth.d.ts +0 -2
- package/dist/commands/daemon.d.ts +0 -2
- package/dist/commands/index.d.ts +0 -4
- package/dist/commands/kill.d.ts +0 -2
- package/dist/config/omnara-config.d.ts +0 -19
- package/dist/daemon/config-store.d.ts +0 -37
- package/dist/daemon/daemon-client.d.ts +0 -27
- package/dist/daemon/daemon-launcher.d.ts +0 -39
- package/dist/daemon/daemon-service.d.ts +0 -30
- package/dist/daemon/directory-registry.d.ts +0 -17
- package/dist/daemon/local-control-server.d.ts +0 -38
- package/dist/daemon/machine-supervisor.d.ts +0 -61
- package/dist/daemon/paths.d.ts +0 -16
- package/dist/daemon/run-daemon.d.ts +0 -1
- package/dist/daemon/session-pid-registry.d.ts +0 -11
- package/dist/daemon/session-runner.d.ts +0 -28
- package/dist/daemon/state-store.d.ts +0 -14
- package/dist/env/env-mode.d.ts +0 -2
- package/dist/http/api-client.d.ts +0 -19
- package/dist/http/machines.d.ts +0 -3
- package/dist/http/user-sessions.d.ts +0 -16
- package/dist/http/workspaces.d.ts +0 -4
- package/dist/index.d.ts +0 -1
- package/dist/orchestrator/agent-orchestrator.d.ts +0 -103
- package/dist/orchestrator/ai-client.d.ts +0 -32
- package/dist/orchestrator/orchestrator-prompt.d.ts +0 -8
- package/dist/orchestrator/orchestrator-prompt.md +0 -222
- package/dist/orchestrator/orchestrator-types.d.ts +0 -168
- package/dist/orchestrator/session.d.ts +0 -82
- package/dist/orchestrator/tools/worker-tools.d.ts +0 -10
- package/dist/orchestrator/utils/completions-manager.d.ts +0 -8
- package/dist/orchestrator/utils/envelope-utils.d.ts +0 -13
- package/dist/orchestrator/utils/index.d.ts +0 -2
- package/dist/orchestrator/utils/session-logger.d.ts +0 -7
- package/dist/orchestrator/utils/worker-events.d.ts +0 -7
- package/dist/orchestrator/utils/worktree-manager.d.ts +0 -51
- package/dist/orchestrator/worker-manager.d.ts +0 -81
- package/dist/orchestrator/worker-types.d.ts +0 -23
- package/dist/orchestrator-prompt.md +0 -222
- package/dist/package-info.d.ts +0 -12
- package/dist/relay/relay-bridge.d.ts +0 -65
- package/dist/relay/relay-service.d.ts +0 -19
- package/dist/schemas/index.d.ts +0 -2
- package/dist/utils/backoff.d.ts +0 -6
- package/dist/utils/browser.d.ts +0 -1
- package/dist/utils/claude-code-check.d.ts +0 -19
- package/dist/utils/executable.d.ts +0 -53
- package/dist/utils/logger.d.ts +0 -143
- package/dist/utils/prompt.d.ts +0 -1
- package/dist/utils/version-check.d.ts +0 -47
- package/dist/utils/websocket.d.ts +0 -5
- package/instrument.mjs +0 -14
- package/scripts/build-executable.ts +0 -244
- package/scripts/copy-assets.mjs +0 -41
- package/scripts/generate-release-json.ts +0 -136
- package/scripts/preinstall.js +0 -141
- package/scripts/test-preinstall.js +0 -124
- package/scripts/upload-release.ts +0 -388
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
# Role: Task Orchestrator
|
|
2
|
-
|
|
3
|
-
You are Omnara, an orchestrator agent. Your job is to coordinate work by delegating to worker agents while staying responsive to user interaction.
|
|
4
|
-
|
|
5
|
-
## The Mental Model
|
|
6
|
-
|
|
7
|
-
**You stay zoomed out. Workers go zoomed in.**
|
|
8
|
-
|
|
9
|
-
You are a coordinator who maintains the big picture. Workers are specialists who dive deep into specific domains. When a worker investigates authentication, they accumulate valuable context about the auth system. That context is an asset - reuse it.
|
|
10
|
-
|
|
11
|
-
**Context is valuable. Accuracy over speed.**
|
|
12
|
-
|
|
13
|
-
A worker who already understands a domain will do better work than a fresh worker starting from zero. Always prefer routing work to workers with relevant context over launching new workers.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Tool Restrictions
|
|
18
|
-
|
|
19
|
-
**FORBIDDEN tools (delegate these to workers):**
|
|
20
|
-
- Write, Edit, Bash, NotebookEdit
|
|
21
|
-
|
|
22
|
-
**Allowed tools (read-only, use sparingly):**
|
|
23
|
-
- Read, Grep, Glob - For quick lookups (1-2 calls max)
|
|
24
|
-
- WebFetch, WebSearch - For external information
|
|
25
|
-
- TodoWrite - For tracking multi-step tasks
|
|
26
|
-
|
|
27
|
-
**Why?** Using forbidden tools blocks your context. Workers execute operations without blocking you. Your job is to coordinate, not implement.
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## The Routing Decision
|
|
32
|
-
|
|
33
|
-
When a user request comes in, follow this decision tree:
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
New request arrives
|
|
37
|
-
|
|
|
38
|
-
v
|
|
39
|
-
Is there a completed worker whose domain matches this request?
|
|
40
|
-
|
|
|
41
|
-
YES --> Route to that worker (message_worker)
|
|
42
|
-
NO --> Is there a running worker whose domain matches?
|
|
43
|
-
|
|
|
44
|
-
YES --> Queue message to that worker (message_worker, interrupt=false)
|
|
45
|
-
NO --> Launch a new worker
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**How to identify matching domains:** Check the worker-status in your system prompt and [Automated Worker Summary] messages. They show task names, status, worktree, and completion summaries.
|
|
49
|
-
|
|
50
|
-
### When to Route to Existing Workers
|
|
51
|
-
|
|
52
|
-
**Workers evolve over time.** A worker's task name reflects what they started with, but they accumulate context as they receive follow-up messages. They may handle related work that wasn't part of their original task but shares context. When deciding whether to route to an existing worker, don't just match on task name - consider whether the worker has touched relevant files, worked in the same domain, or has context that would be useful even if the new request isn't exactly what they originally did.
|
|
53
|
-
|
|
54
|
-
Route to an existing worker when:
|
|
55
|
-
- The request involves files/code that worker has touched
|
|
56
|
-
- The request is in the same feature area
|
|
57
|
-
- The request builds on or modifies previous work
|
|
58
|
-
- The user is asking about work a worker did
|
|
59
|
-
- Understanding prior decisions would be valuable
|
|
60
|
-
- **A bug or question comes up related to work a worker previously did** - Message that worker to investigate/fix it instead of investigating yourself or asking the user for direction. The worker has the context and will be more effective.
|
|
61
|
-
|
|
62
|
-
### When to Launch New Workers
|
|
63
|
-
|
|
64
|
-
Launch a new worker only when:
|
|
65
|
-
- No existing worker has relevant context
|
|
66
|
-
- The request is in a completely unrelated domain
|
|
67
|
-
- The user explicitly asks for a separate task
|
|
68
|
-
- Work would conflict with an existing worker's activity
|
|
69
|
-
|
|
70
|
-
### Routing Examples
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
Worker "auth-impl" previously: Implemented login/logout
|
|
74
|
-
|
|
75
|
-
User: "Add password reset"
|
|
76
|
-
--> Message "auth-impl" (same domain, they know the auth system)
|
|
77
|
-
|
|
78
|
-
User: "Add dark mode to settings"
|
|
79
|
-
--> Launch new worker (unrelated domain)
|
|
80
|
-
|
|
81
|
-
User: "Why did you use JWT instead of sessions?"
|
|
82
|
-
--> Message "auth-impl" (they made that decision)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Using message_worker
|
|
88
|
-
|
|
89
|
-
**interrupt=false (default):** Queue message for after current work
|
|
90
|
-
- Use for: Follow-up tasks, additional requirements, questions
|
|
91
|
-
|
|
92
|
-
**interrupt=true:** Stop current work immediately
|
|
93
|
-
- Use only when: User explicitly says stop, or new info contradicts current direction
|
|
94
|
-
|
|
95
|
-
**Message content should include:**
|
|
96
|
-
- What the user is asking for
|
|
97
|
-
- How it relates to the worker's previous work (if not obvious)
|
|
98
|
-
- Any new context from the user
|
|
99
|
-
|
|
100
|
-
**After messaging:** Don't poll with get_workers. You'll be automatically notified when the worker completes.
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## Launching Workers
|
|
105
|
-
|
|
106
|
-
When you do need to launch new workers:
|
|
107
|
-
|
|
108
|
-
**Provide clear instructions:**
|
|
109
|
-
- What to do
|
|
110
|
-
- What information to return
|
|
111
|
-
- Any relevant context you gathered
|
|
112
|
-
|
|
113
|
-
**Use worktree_name for isolation:**
|
|
114
|
-
- `worktree_name="feature-x"` creates an isolated git branch
|
|
115
|
-
- Multiple workers with same worktree_name share that branch
|
|
116
|
-
- Different worktree_names = fully isolated work
|
|
117
|
-
- Omit for trivial changes (typos, docs)
|
|
118
|
-
|
|
119
|
-
**Example delegation:**
|
|
120
|
-
```
|
|
121
|
-
User: "Add rate limiting to the API"
|
|
122
|
-
|
|
123
|
-
launch_worker with prompt: "Add rate limiting middleware to the API.
|
|
124
|
-
Apply globally with 100 requests per 15 minutes.
|
|
125
|
-
Document the configuration in comments."
|
|
126
|
-
worktree_name: "add-rate-limiting"
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Multiple Workers
|
|
132
|
-
|
|
133
|
-
**Parallel workers are appropriate when:**
|
|
134
|
-
- Tasks are in completely different domains
|
|
135
|
-
- Tasks don't depend on each other's results
|
|
136
|
-
- Example: "Fix auth bug AND add logging feature" - 2 workers, different worktrees
|
|
137
|
-
|
|
138
|
-
**Sequential work should reuse the same worker:**
|
|
139
|
-
- "Research auth libraries, then implement" - One worker does both
|
|
140
|
-
- "Implement feature, then add tests" - Same worker continues
|
|
141
|
-
|
|
142
|
-
**Avoid:** Launching parallel workers for tightly related work. The workers won't share context and may make inconsistent decisions.
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## Worktree Patterns
|
|
147
|
-
|
|
148
|
-
**Same worktree, same worker (preferred for sequential work):**
|
|
149
|
-
```
|
|
150
|
-
launch_worker(worktree_name="feature-x", ...)
|
|
151
|
-
[worker completes]
|
|
152
|
-
message_worker(task="feature-x", message="Now do the next step...")
|
|
153
|
-
```
|
|
154
|
-
Context preserved. Worker knows the domain.
|
|
155
|
-
|
|
156
|
-
**Different worktrees (for unrelated parallel work):**
|
|
157
|
-
```
|
|
158
|
-
launch_worker(worktree_name="feature-x", ...)
|
|
159
|
-
launch_worker(worktree_name="feature-y", ...)
|
|
160
|
-
```
|
|
161
|
-
Fully isolated. Different features/branches.
|
|
162
|
-
|
|
163
|
-
**Same worktree, different workers (rare - only when you want fresh perspective):**
|
|
164
|
-
```
|
|
165
|
-
launch_worker(worktree_name="feature-x", ...)
|
|
166
|
-
[worker completes]
|
|
167
|
-
launch_worker(worktree_name="feature-x", ...) # New worker, context discarded
|
|
168
|
-
```
|
|
169
|
-
Use sparingly. Loses accumulated knowledge.
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## TodoWrite
|
|
174
|
-
|
|
175
|
-
Use for multi-step tasks (2+ sequential steps) to give users visibility.
|
|
176
|
-
|
|
177
|
-
**Todo states:** pending, in_progress, completed
|
|
178
|
-
**Keep exactly ONE todo in_progress at a time.**
|
|
179
|
-
|
|
180
|
-
```
|
|
181
|
-
User: "Add OAuth, then test it"
|
|
182
|
-
|
|
183
|
-
TodoWrite:
|
|
184
|
-
1. "Implement OAuth" - in_progress
|
|
185
|
-
2. "Test OAuth flow" - pending
|
|
186
|
-
|
|
187
|
-
[Worker completes step 1]
|
|
188
|
-
Update: step 1 completed, step 2 in_progress
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Don't use TodoWrite for single tasks or simple lookups.
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
## Responding to Worker Completions
|
|
196
|
-
|
|
197
|
-
When a worker completes, you receive an [Automated Worker Summary] message containing what the worker accomplished.
|
|
198
|
-
|
|
199
|
-
**Your response should:**
|
|
200
|
-
1. Report ONLY the new completion (not previously reported ones)
|
|
201
|
-
2. Keep it brief: "The auth worker completed. Login/logout endpoints are implemented."
|
|
202
|
-
3. Note next steps if applicable
|
|
203
|
-
|
|
204
|
-
**Don't:** Re-summarize all workers. Re-explain previous completions. Provide comprehensive recaps unless asked.
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## Remember
|
|
209
|
-
|
|
210
|
-
**Your role:** Coordinator, not implementer. Stay zoomed out.
|
|
211
|
-
|
|
212
|
-
**Tool restrictions:** Never use Write, Edit, Bash, NotebookEdit directly. Always delegate.
|
|
213
|
-
|
|
214
|
-
**Routing priority:** Existing workers with context > New workers. Context is valuable.
|
|
215
|
-
|
|
216
|
-
**Accuracy over speed:** One worker with good context beats two workers duplicating effort.
|
|
217
|
-
|
|
218
|
-
**Stay responsive:** Delegate to keep your context unblocked for user interaction.
|
|
219
|
-
|
|
220
|
-
**Worker status:** Check worker-status in your system prompt and [Automated Worker Summary] messages. Don't poll with get_workers.
|
|
221
|
-
|
|
222
|
-
**When in doubt:** Route to an existing worker if one has relevant context. Otherwise, delegate to a new worker.
|
package/dist/package-info.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Package information constants.
|
|
3
|
-
*
|
|
4
|
-
* These are replaced at build time by esbuild/bun with values from package.json.
|
|
5
|
-
* The build process uses --define flags to replace __PACKAGE_* constants.
|
|
6
|
-
*
|
|
7
|
-
* In bundled context: Constants are replaced with literal strings at compile time.
|
|
8
|
-
* In dev context: Falls back to default values (actual version comes from build).
|
|
9
|
-
*/
|
|
10
|
-
export declare const PACKAGE_NAME: string;
|
|
11
|
-
export declare const PACKAGE_VERSION: string;
|
|
12
|
-
export declare const PACKAGE_DESCRIPTION: string;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import EventEmitter from 'events';
|
|
2
|
-
import { AgentOrchestrator } from '../orchestrator/agent-orchestrator.js';
|
|
3
|
-
import { CredentialsStore } from '../auth/credentials-store.js';
|
|
4
|
-
export interface RelayBridgeOptions {
|
|
5
|
-
store?: CredentialsStore;
|
|
6
|
-
logger?: Console;
|
|
7
|
-
backendUrl: string;
|
|
8
|
-
frontendUrl?: string;
|
|
9
|
-
workspaceId?: string;
|
|
10
|
-
userSessionId?: string;
|
|
11
|
-
agentSessionId?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class RelayBridge extends EventEmitter {
|
|
14
|
-
private readonly orchestrator;
|
|
15
|
-
private readonly store;
|
|
16
|
-
private readonly logger;
|
|
17
|
-
private readonly backendUrl;
|
|
18
|
-
private readonly frontendUrl?;
|
|
19
|
-
private readonly workspaceId;
|
|
20
|
-
private connectionHandle;
|
|
21
|
-
private ws;
|
|
22
|
-
private stopped;
|
|
23
|
-
private pendingOutbound;
|
|
24
|
-
private pingTimer;
|
|
25
|
-
private heartbeatIntervalMs;
|
|
26
|
-
private authProviderPromise;
|
|
27
|
-
private userSessionId;
|
|
28
|
-
private currentAgentSessionId;
|
|
29
|
-
private readonly attachAgentSessionId;
|
|
30
|
-
private browserOpened;
|
|
31
|
-
private canceled;
|
|
32
|
-
private waitingForLogin;
|
|
33
|
-
constructor(orchestrator: AgentOrchestrator, options: RelayBridgeOptions);
|
|
34
|
-
start(): Promise<void>;
|
|
35
|
-
stop(): Promise<void>;
|
|
36
|
-
private establishConnection;
|
|
37
|
-
private getAuthProvider;
|
|
38
|
-
private ensureAgentSessionExists;
|
|
39
|
-
private ensureUserSession;
|
|
40
|
-
private sendPrimarySessionInit;
|
|
41
|
-
private sendFrame;
|
|
42
|
-
private handleOutboundControl;
|
|
43
|
-
private handleWebsocketLifecycle;
|
|
44
|
-
private handleInbound;
|
|
45
|
-
private tryHandleControlMessage;
|
|
46
|
-
private tryHandleMessageEnvelope;
|
|
47
|
-
private handleSessionBootstrap;
|
|
48
|
-
private handleSessionInitAck;
|
|
49
|
-
private handleSessionAnnounce;
|
|
50
|
-
private handleCancelAgent;
|
|
51
|
-
private handleSessionClosed;
|
|
52
|
-
private handleGitDiffRequest;
|
|
53
|
-
private handleGitFileDiffRequest;
|
|
54
|
-
private handleSessionSettingsRequest;
|
|
55
|
-
private handleRelayRequest;
|
|
56
|
-
private handleMessageEnvelope;
|
|
57
|
-
private isTextContent;
|
|
58
|
-
private isMessageEnvelope;
|
|
59
|
-
private enqueue;
|
|
60
|
-
private sendSessionInitControl;
|
|
61
|
-
private flushQueue;
|
|
62
|
-
private startPingTimer;
|
|
63
|
-
private clearLoginWait;
|
|
64
|
-
private closeCurrentSocket;
|
|
65
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ApiClient } from '../http/api-client.js';
|
|
2
|
-
export type RelayClientKind = 'cli' | 'web' | 'mobile' | 'voice';
|
|
3
|
-
export interface RelayRegistration {
|
|
4
|
-
userSessionId: string;
|
|
5
|
-
relayToken: string;
|
|
6
|
-
relayTokenExpiresIn: number;
|
|
7
|
-
relayWsPath: string;
|
|
8
|
-
relayHeartbeatIntervalSec: number;
|
|
9
|
-
}
|
|
10
|
-
export interface RelayTokenRefresh {
|
|
11
|
-
relayToken: string;
|
|
12
|
-
relayTokenExpiresIn: number;
|
|
13
|
-
}
|
|
14
|
-
export interface RegisterRelayOptions {
|
|
15
|
-
userSessionId: string;
|
|
16
|
-
clientKind?: RelayClientKind;
|
|
17
|
-
}
|
|
18
|
-
export declare function registerRelaySession(client: ApiClient, accessToken: string, options: RegisterRelayOptions): Promise<RelayRegistration>;
|
|
19
|
-
export declare function refreshRelayToken(client: ApiClient, accessToken: string, relayToken: string): Promise<RelayTokenRefresh>;
|
package/dist/schemas/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export type { ControlMessage, MessageEnvelope, ControlMessageSchema, MessageEnvelopeSchema, MachineMessage, ValidationError, } from '@omnara/shared-js/schemas';
|
|
2
|
-
export { validateControlMessage, validateMessageEnvelope, validateMachineMessage, } from '@omnara/shared-js/schemas';
|
package/dist/utils/backoff.d.ts
DELETED
package/dist/utils/browser.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function tryOpenBrowser(url: string): void;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Finds the path to the Claude Code executable.
|
|
3
|
-
*
|
|
4
|
-
* When running from a Bun single-file executable, the SDK's default resolution
|
|
5
|
-
* fails because it looks for cli.js relative to the bundled module location,
|
|
6
|
-
* which points to Bun's virtual filesystem (/$bunfs/root/cli.js).
|
|
7
|
-
*
|
|
8
|
-
* For Bun SFE, we MUST find the real claude executable via `which`.
|
|
9
|
-
* For Node.js, we can let the SDK handle it (return empty object).
|
|
10
|
-
*/
|
|
11
|
-
export declare function claudeExecutablePath(): {
|
|
12
|
-
pathToClaudeCodeExecutable?: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Performs the Claude Code check and displays warning if needed
|
|
16
|
-
* @param options - Optional configuration for the check
|
|
17
|
-
* @returns boolean indicating if either authentication method is available
|
|
18
|
-
*/
|
|
19
|
-
export declare function performClaudeCodeCheck(): Promise<boolean>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for handling Bun single-file executable (SFE) detection and spawning.
|
|
3
|
-
*
|
|
4
|
-
* BACKGROUND (from Bun docs and GitHub issues):
|
|
5
|
-
* When Bun compiles a script into a single-file executable, it creates a virtual
|
|
6
|
-
* filesystem at /$bunfs/root/ where the embedded code lives. This means:
|
|
7
|
-
*
|
|
8
|
-
* When running as a Bun SFE:
|
|
9
|
-
* - process.execPath = /path/to/omnara (the compiled binary)
|
|
10
|
-
* - process.argv[0] = "bun"
|
|
11
|
-
* - process.argv[1] = "/$bunfs/root/omnara-darwin-arm64" (virtual filesystem path)
|
|
12
|
-
*
|
|
13
|
-
* When running via Node.js or `bun run`:
|
|
14
|
-
* - process.execPath = /usr/bin/node or /path/to/bun
|
|
15
|
-
* - process.argv[0] = same as execPath
|
|
16
|
-
* - process.argv[1] = /path/to/cli.js (the actual script file)
|
|
17
|
-
*
|
|
18
|
-
* KEY INSIGHT (from Jarred Sumner, Bun team):
|
|
19
|
-
* - For the executable path, use `process.execPath`
|
|
20
|
-
* - The /$bunfs/ path is NOT a usable filesystem location
|
|
21
|
-
*
|
|
22
|
-
* DETECTION:
|
|
23
|
-
* Check if process.argv[1] starts with "/$bunfs/" to detect SFE mode.
|
|
24
|
-
*
|
|
25
|
-
* SPAWNING:
|
|
26
|
-
* In SFE mode: spawn(process.execPath, ['daemon', 'run-service'])
|
|
27
|
-
* In script mode: spawn(process.execPath, [process.argv[1], 'daemon', 'run-service'])
|
|
28
|
-
*
|
|
29
|
-
* References:
|
|
30
|
-
* - https://bun.com/docs/bundler/executables
|
|
31
|
-
* - https://github.com/oven-sh/bun/issues/8476
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* Detects if running as a Bun single-file executable.
|
|
35
|
-
* In Bun SFE, process.argv[1] points to Bun's virtual filesystem (/$bunfs/root/...).
|
|
36
|
-
*
|
|
37
|
-
* This is the official detection method per Bun documentation and GitHub issues.
|
|
38
|
-
*/
|
|
39
|
-
export declare function isBunSingleFileExecutable(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Gets the arguments needed to spawn a new instance of this CLI.
|
|
42
|
-
* For Bun SFE, returns just the command args.
|
|
43
|
-
* For Node.js, prepends the script path.
|
|
44
|
-
*
|
|
45
|
-
* @param commandArgs - The CLI command and arguments (e.g., ['daemon', 'run-service'])
|
|
46
|
-
* @returns The full args array to pass to spawn(process.execPath, args)
|
|
47
|
-
*/
|
|
48
|
-
export declare function getSpawnArgs(commandArgs: string[]): string[];
|
|
49
|
-
/**
|
|
50
|
-
* Gets the executable path for spawning a new instance of this CLI.
|
|
51
|
-
* Always returns process.execPath (works for both Node.js and Bun SFE).
|
|
52
|
-
*/
|
|
53
|
-
export declare function getExecutablePath(): string;
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Logger utility for controlling console output based on environment
|
|
3
|
-
*
|
|
4
|
-
* Production detection:
|
|
5
|
-
* 1. NODE_ENV === 'production'
|
|
6
|
-
* 2. OMNARA_LOG_LEVEL === 'none' or 'error'
|
|
7
|
-
* 3. Running from compiled dist/ directory (not tsx/ts-node)
|
|
8
|
-
*/
|
|
9
|
-
import type { InspectOptions } from 'util';
|
|
10
|
-
/**
|
|
11
|
-
* Log levels for controlling output verbosity
|
|
12
|
-
*/
|
|
13
|
-
export declare enum LogLevel {
|
|
14
|
-
NONE = 0,
|
|
15
|
-
ERROR = 1,
|
|
16
|
-
WARN = 2,
|
|
17
|
-
INFO = 3,
|
|
18
|
-
DEBUG = 4,
|
|
19
|
-
VERBOSE = 5
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Detects if the CLI is running in production mode
|
|
23
|
-
*/
|
|
24
|
-
export declare function isProduction(): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Gets the current log level from environment or defaults
|
|
27
|
-
*/
|
|
28
|
-
export declare function getLogLevel(): LogLevel;
|
|
29
|
-
/**
|
|
30
|
-
* Logger interface that extends Console but can be controlled
|
|
31
|
-
*/
|
|
32
|
-
export interface Logger extends Console {
|
|
33
|
-
important(...args: unknown[]): void;
|
|
34
|
-
success(...args: unknown[]): void;
|
|
35
|
-
close?(): Promise<void>;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Creates a controlled logger instance
|
|
39
|
-
*/
|
|
40
|
-
type LogSink = (entry: {
|
|
41
|
-
line: string;
|
|
42
|
-
raw: unknown[];
|
|
43
|
-
}) => void;
|
|
44
|
-
export declare class ControlledLogger implements Logger {
|
|
45
|
-
private logLevel;
|
|
46
|
-
private forceOutput;
|
|
47
|
-
private _console;
|
|
48
|
-
private sinks;
|
|
49
|
-
private closers;
|
|
50
|
-
private formatLine;
|
|
51
|
-
Console: typeof console.Console;
|
|
52
|
-
constructor(options?: {
|
|
53
|
-
logLevel?: LogLevel;
|
|
54
|
-
forceOutput?: boolean;
|
|
55
|
-
sinks?: LogSink[];
|
|
56
|
-
closers?: Array<() => Promise<void> | void>;
|
|
57
|
-
});
|
|
58
|
-
/**
|
|
59
|
-
* Standard log output (INFO level)
|
|
60
|
-
*/
|
|
61
|
-
log(...args: unknown[]): void;
|
|
62
|
-
/**
|
|
63
|
-
* Error output (always shown unless NONE)
|
|
64
|
-
*/
|
|
65
|
-
error(...args: unknown[]): void;
|
|
66
|
-
/**
|
|
67
|
-
* Warning output
|
|
68
|
-
*/
|
|
69
|
-
warn(...args: unknown[]): void;
|
|
70
|
-
/**
|
|
71
|
-
* Info level output
|
|
72
|
-
*/
|
|
73
|
-
info(...args: unknown[]): void;
|
|
74
|
-
/**
|
|
75
|
-
* Debug output (only in development)
|
|
76
|
-
*/
|
|
77
|
-
debug(...args: unknown[]): void;
|
|
78
|
-
/**
|
|
79
|
-
* Verbose/trace output
|
|
80
|
-
*/
|
|
81
|
-
trace(...args: unknown[]): void;
|
|
82
|
-
/**
|
|
83
|
-
* Important messages that should always be shown to user
|
|
84
|
-
* (authentication status, connection info, etc.)
|
|
85
|
-
*/
|
|
86
|
-
important(...args: unknown[]): void;
|
|
87
|
-
/**
|
|
88
|
-
* Success messages that should typically be shown
|
|
89
|
-
*/
|
|
90
|
-
success(...args: unknown[]): void;
|
|
91
|
-
close(): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* Check if a message should be logged at the given level
|
|
94
|
-
*/
|
|
95
|
-
private shouldLog;
|
|
96
|
-
private write;
|
|
97
|
-
/**
|
|
98
|
-
* Update the log level dynamically
|
|
99
|
-
*/
|
|
100
|
-
setLogLevel(level: LogLevel): void;
|
|
101
|
-
/**
|
|
102
|
-
* Get current log level
|
|
103
|
-
*/
|
|
104
|
-
getLogLevel(): LogLevel;
|
|
105
|
-
assert(condition?: boolean, ...data: unknown[]): void;
|
|
106
|
-
clear(): void;
|
|
107
|
-
count(label?: string): void;
|
|
108
|
-
countReset(label?: string): void;
|
|
109
|
-
dir(item?: unknown, options?: InspectOptions): void;
|
|
110
|
-
dirxml(...data: unknown[]): void;
|
|
111
|
-
group(...data: unknown[]): void;
|
|
112
|
-
groupCollapsed(...data: unknown[]): void;
|
|
113
|
-
groupEnd(): void;
|
|
114
|
-
table(tabularData?: unknown, properties?: string[]): void;
|
|
115
|
-
time(label?: string): void;
|
|
116
|
-
timeEnd(label?: string): void;
|
|
117
|
-
timeLog(label?: string, ...data: unknown[]): void;
|
|
118
|
-
timeStamp(label?: string): void;
|
|
119
|
-
profile(label?: string): void;
|
|
120
|
-
profileEnd(label?: string): void;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Global logger instance
|
|
124
|
-
*/
|
|
125
|
-
export declare const logger: ControlledLogger;
|
|
126
|
-
/**
|
|
127
|
-
* Creates a logger for a specific component
|
|
128
|
-
*/
|
|
129
|
-
export declare function createLogger(componentName?: string, options?: {
|
|
130
|
-
logLevel?: LogLevel;
|
|
131
|
-
forceOutput?: boolean;
|
|
132
|
-
sinks?: LogSink[];
|
|
133
|
-
closers?: Array<() => Promise<void> | void>;
|
|
134
|
-
}): Logger;
|
|
135
|
-
/**
|
|
136
|
-
* Helper to extract error messages consistently
|
|
137
|
-
*/
|
|
138
|
-
export declare function extractErrorMessage(error: unknown): string;
|
|
139
|
-
/**
|
|
140
|
-
* Print current logger configuration (useful for debugging)
|
|
141
|
-
*/
|
|
142
|
-
export declare function printLoggerConfig(): void;
|
|
143
|
-
export {};
|
package/dist/utils/prompt.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function prompt(question: string): Promise<string>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export declare const IS_PRERELEASE: boolean;
|
|
2
|
-
/**
|
|
3
|
-
* Detects if the CLI was installed via npm (not as a standalone binary).
|
|
4
|
-
*/
|
|
5
|
-
export declare function isNpmInstallation(): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Runs the installation script to install/update the binary version.
|
|
8
|
-
* Returns true if installation succeeded.
|
|
9
|
-
* Passes PRERELEASE=1 env var to install script if in prerelease mode.
|
|
10
|
-
*
|
|
11
|
-
* @param options.silent - If true, suppress output (for daemon background updates)
|
|
12
|
-
*/
|
|
13
|
-
export declare function runInstallScript(options?: {
|
|
14
|
-
silent?: boolean;
|
|
15
|
-
}): Promise<boolean>;
|
|
16
|
-
/**
|
|
17
|
-
* Handles npm installation: show warning and migrate to binary.
|
|
18
|
-
*/
|
|
19
|
-
export declare function handleNpmInstallation(): Promise<boolean>;
|
|
20
|
-
/**
|
|
21
|
-
* Checks if an update is available.
|
|
22
|
-
* Checks prerelease channel if PRERELEASE=1 env var is set.
|
|
23
|
-
*/
|
|
24
|
-
export declare function checkForUpdate(): Promise<{
|
|
25
|
-
available: boolean;
|
|
26
|
-
latestVersion?: string;
|
|
27
|
-
currentVersion: string;
|
|
28
|
-
isPrerelease: boolean;
|
|
29
|
-
}>;
|
|
30
|
-
/**
|
|
31
|
-
* Performs an update by running the install script.
|
|
32
|
-
* Used by both CLI and daemon for updates.
|
|
33
|
-
*/
|
|
34
|
-
export declare function performUpdate(options?: {
|
|
35
|
-
silent?: boolean;
|
|
36
|
-
}): Promise<boolean>;
|
|
37
|
-
/**
|
|
38
|
-
* Background update check for the daemon.
|
|
39
|
-
* Checks for updates and triggers install script if available.
|
|
40
|
-
*/
|
|
41
|
-
export declare function daemonUpdateCheck(): Promise<boolean>;
|
|
42
|
-
/**
|
|
43
|
-
* Checks for updates and performs auto-update if available.
|
|
44
|
-
* Called when CLI starts.
|
|
45
|
-
* Returns true if an update was installed and the CLI should exit.
|
|
46
|
-
*/
|
|
47
|
-
export declare function attemptUpdate(): Promise<boolean>;
|
package/instrument.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/node';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_DSN =
|
|
4
|
-
'https://ad24dca67a2ab987c433aba53f738743@o4509630021828608.ingest.us.sentry.io/4510413097467904';
|
|
5
|
-
|
|
6
|
-
const dsn = process.env.OMNARA_SENTRY_DSN ?? process.env.SENTRY_DSN ?? DEFAULT_DSN;
|
|
7
|
-
|
|
8
|
-
if (dsn) {
|
|
9
|
-
Sentry.init({
|
|
10
|
-
dsn,
|
|
11
|
-
environment: process.env.OMNARA_ENV ?? process.env.NODE_ENV ?? 'production',
|
|
12
|
-
sendDefaultPii: false,
|
|
13
|
-
});
|
|
14
|
-
}
|