oh-my-openagent 5.1.70 → 5.1.72
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/cli/index.js +369 -123
- package/dist/cli/service-auth/protocol-request.d.ts +1 -0
- package/dist/cli/service-auth/protocol.d.ts +2 -2
- package/dist/cli-node/index.js +369 -123
- package/dist/features/team-mode/team-runtime/resolve-member-dependencies.d.ts +6 -3
- package/dist/hooks/legacy-plugin-toast/plugin-entry-migrator.d.ts +2 -1
- package/dist/index.js +1353 -1326
- package/dist/skills/browser/runtime/omowright/manifest.json +1 -1
- package/dist/tools/session-manager/constants.d.ts +1 -3
- package/dist/tui.js +30 -14
- package/package.json +14 -14
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +10 -0
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +12 -2
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2132,7 +2132,7 @@ var package_default;
|
|
|
2132
2132
|
var init_package = __esm(() => {
|
|
2133
2133
|
package_default = {
|
|
2134
2134
|
name: "oh-my-opencode",
|
|
2135
|
-
version: "5.1.
|
|
2135
|
+
version: "5.1.72",
|
|
2136
2136
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2137
2137
|
main: "./dist/index.js",
|
|
2138
2138
|
types: "dist/index.d.ts",
|
|
@@ -2330,7 +2330,7 @@ var init_package = __esm(() => {
|
|
|
2330
2330
|
},
|
|
2331
2331
|
devDependencies: {
|
|
2332
2332
|
"@clack/prompts": "^1.8.1",
|
|
2333
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
2333
|
+
"@code-yeongyu/senpi": "2026.11.15-2",
|
|
2334
2334
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
2335
2335
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
2336
2336
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
@@ -2403,18 +2403,18 @@ var init_package = __esm(() => {
|
|
|
2403
2403
|
typescript: "^7.0.2"
|
|
2404
2404
|
},
|
|
2405
2405
|
optionalDependencies: {
|
|
2406
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
2407
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
2408
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
2409
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
2410
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
2411
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
2412
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
2413
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
2414
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
2415
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
2416
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
2417
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
2406
|
+
"oh-my-opencode-darwin-arm64": "5.1.72",
|
|
2407
|
+
"oh-my-opencode-darwin-x64": "5.1.72",
|
|
2408
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.72",
|
|
2409
|
+
"oh-my-opencode-linux-arm64": "5.1.72",
|
|
2410
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.72",
|
|
2411
|
+
"oh-my-opencode-linux-x64": "5.1.72",
|
|
2412
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.72",
|
|
2413
|
+
"oh-my-opencode-linux-x64-musl": "5.1.72",
|
|
2414
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.72",
|
|
2415
|
+
"oh-my-opencode-windows-arm64": "5.1.72",
|
|
2416
|
+
"oh-my-opencode-windows-x64": "5.1.72",
|
|
2417
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.72"
|
|
2418
2418
|
},
|
|
2419
2419
|
overrides: {
|
|
2420
2420
|
hono: "^4.13.8",
|
|
@@ -77756,6 +77756,16 @@ var init_provenance = __esm(() => {
|
|
|
77756
77756
|
}).strict();
|
|
77757
77757
|
});
|
|
77758
77758
|
|
|
77759
|
+
// packages/omo-config-core/src/schema/session-wake.ts
|
|
77760
|
+
var OmoSessionWakeSettingsSchema;
|
|
77761
|
+
var init_session_wake = __esm(() => {
|
|
77762
|
+
init_zod();
|
|
77763
|
+
OmoSessionWakeSettingsSchema = object({
|
|
77764
|
+
same_device: boolean2().optional(),
|
|
77765
|
+
wake_limit: number2().int().min(0).optional()
|
|
77766
|
+
}).strict();
|
|
77767
|
+
});
|
|
77768
|
+
|
|
77759
77769
|
// packages/omo-config-core/src/schema/config.ts
|
|
77760
77770
|
var OmoOpenCodeHarnessConfigSchema, OmoDisabledSkillsSchema, OmoExcludedModelsSchema, OmoTypedHarnessConfigSchema, OmoConfigProfileSchema, OmoConfigSchema, OmoConfigLayerSchema;
|
|
77761
77771
|
var init_config = __esm(() => {
|
|
@@ -77775,11 +77785,13 @@ var init_config = __esm(() => {
|
|
|
77775
77785
|
init_device_service();
|
|
77776
77786
|
init_format_on_mutation();
|
|
77777
77787
|
init_provenance();
|
|
77788
|
+
init_session_wake();
|
|
77778
77789
|
OmoOpenCodeHarnessConfigSchema = record(string2(), unknown());
|
|
77779
77790
|
OmoDisabledSkillsSchema = array(string2());
|
|
77780
77791
|
OmoExcludedModelsSchema = array(string2());
|
|
77781
77792
|
OmoTypedHarnessConfigSchema = object({
|
|
77782
77793
|
provenance: OmoProvenanceSettingsSchema.optional(),
|
|
77794
|
+
session_wake: OmoSessionWakeSettingsSchema.optional(),
|
|
77783
77795
|
formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
|
|
77784
77796
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
77785
77797
|
agents: OmoAgentsConfigSchema.optional(),
|
|
@@ -77800,6 +77812,7 @@ var init_config = __esm(() => {
|
|
|
77800
77812
|
}).strict();
|
|
77801
77813
|
OmoConfigProfileSchema = object({
|
|
77802
77814
|
provenance: OmoProvenanceSettingsSchema.optional(),
|
|
77815
|
+
session_wake: OmoSessionWakeSettingsSchema.optional(),
|
|
77803
77816
|
formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
|
|
77804
77817
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
77805
77818
|
agents: OmoAgentsConfigSchema.optional(),
|
|
@@ -77824,6 +77837,7 @@ var init_config = __esm(() => {
|
|
|
77824
77837
|
}).strict();
|
|
77825
77838
|
OmoConfigSchema = object({
|
|
77826
77839
|
provenance: OmoProvenanceSettingsSchema.optional(),
|
|
77840
|
+
session_wake: OmoSessionWakeSettingsSchema.optional(),
|
|
77827
77841
|
formatOnMutation: OmoFormatOnMutationSchema.optional(),
|
|
77828
77842
|
$schema: string2().optional(),
|
|
77829
77843
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
@@ -77852,6 +77866,7 @@ var init_config = __esm(() => {
|
|
|
77852
77866
|
}).strict();
|
|
77853
77867
|
OmoConfigLayerSchema = object({
|
|
77854
77868
|
provenance: OmoProvenanceSettingsSchema.optional(),
|
|
77869
|
+
session_wake: OmoSessionWakeSettingsSchema.optional(),
|
|
77855
77870
|
formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
|
|
77856
77871
|
$schema: string2().optional(),
|
|
77857
77872
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
@@ -78013,6 +78028,7 @@ var init_schema = __esm(() => {
|
|
|
78013
78028
|
init_model_profile();
|
|
78014
78029
|
init_model_ref();
|
|
78015
78030
|
init_provenance();
|
|
78031
|
+
init_session_wake();
|
|
78016
78032
|
init_side_panel();
|
|
78017
78033
|
init_task();
|
|
78018
78034
|
init_team();
|
|
@@ -92861,7 +92877,7 @@ var package_default2;
|
|
|
92861
92877
|
var init_package2 = __esm(() => {
|
|
92862
92878
|
package_default2 = {
|
|
92863
92879
|
name: "@oh-my-opencode/omo-codex",
|
|
92864
|
-
version: "5.1.
|
|
92880
|
+
version: "5.1.72",
|
|
92865
92881
|
type: "module",
|
|
92866
92882
|
private: true,
|
|
92867
92883
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -100252,6 +100268,7 @@ var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
|
100252
100268
|
join66("extensions", "loro_wasm_bg.wasm"),
|
|
100253
100269
|
join66("extensions", "CaseFolding.txt"),
|
|
100254
100270
|
join66("extensions", "omo-thread-client.js"),
|
|
100271
|
+
join66("extensions", "omo-wake.js"),
|
|
100255
100272
|
join66("extensions", "omo-telemetry-recovery.js"),
|
|
100256
100273
|
join66("extensions", "omo-feedback.js"),
|
|
100257
100274
|
join66("extensions", "omo-desktop-toolkit.js"),
|
|
@@ -109648,14 +109665,15 @@ var package_default3 = {
|
|
|
109648
109665
|
},
|
|
109649
109666
|
dependencies: {
|
|
109650
109667
|
"@clack/prompts": "^1.8.1",
|
|
109651
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
109652
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.
|
|
109668
|
+
"@code-yeongyu/senpi": "2026.11.15-2",
|
|
109669
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.15-2",
|
|
109653
109670
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
109654
109671
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
109655
109672
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
109656
109673
|
"@oh-my-opencode/claude-code-compat-core": "workspace:*",
|
|
109657
109674
|
"@oh-my-opencode/comment-checker-core": "workspace:*",
|
|
109658
109675
|
"@oh-my-opencode/delegate-core": "workspace:*",
|
|
109676
|
+
"@oh-my-opencode/device-service-core": "workspace:*",
|
|
109659
109677
|
"@oh-my-opencode/hashline-core": "workspace:*",
|
|
109660
109678
|
"@oh-my-opencode/mcp-client-core": "workspace:*",
|
|
109661
109679
|
"@oh-my-opencode/model-core": "workspace:*",
|
|
@@ -112674,14 +112692,6 @@ class RequestFailure extends SignInError {
|
|
|
112674
112692
|
this.responseStatus = responseStatus;
|
|
112675
112693
|
}
|
|
112676
112694
|
}
|
|
112677
|
-
|
|
112678
|
-
class InvalidApiResponse extends SignInError {
|
|
112679
|
-
status;
|
|
112680
|
-
constructor(status) {
|
|
112681
|
-
super("The service returned an invalid error response.");
|
|
112682
|
-
this.status = status;
|
|
112683
|
-
}
|
|
112684
|
-
}
|
|
112685
112695
|
var platformSchema = _enum(["macos", "linux", "windows"]);
|
|
112686
112696
|
var nonempty = string2().min(1);
|
|
112687
112697
|
var timestamp = string2().datetime({ offset: true });
|
|
@@ -112713,15 +112723,6 @@ var deviceCodeSchema = object({
|
|
|
112713
112723
|
expiresAt: timestamp,
|
|
112714
112724
|
intervalSeconds: number2().int().min(1).max(60)
|
|
112715
112725
|
});
|
|
112716
|
-
var envelopeSchema = object({
|
|
112717
|
-
error: object({
|
|
112718
|
-
code: nonempty,
|
|
112719
|
-
message: string2(),
|
|
112720
|
-
retryable: boolean2(),
|
|
112721
|
-
requestId: string2(),
|
|
112722
|
-
detail: unknown().optional()
|
|
112723
|
-
})
|
|
112724
|
-
});
|
|
112725
112726
|
var limitSchema = object({
|
|
112726
112727
|
reason: literal("device_limit"),
|
|
112727
112728
|
managementToken: nonempty,
|
|
@@ -112858,59 +112859,6 @@ function serviceOrigin(value) {
|
|
|
112858
112859
|
}
|
|
112859
112860
|
return url.origin;
|
|
112860
112861
|
}
|
|
112861
|
-
async function requestApi(api, path, init, signal) {
|
|
112862
|
-
let response;
|
|
112863
|
-
let body;
|
|
112864
|
-
try {
|
|
112865
|
-
response = await fetch(`${api}${path}`, {
|
|
112866
|
-
...init,
|
|
112867
|
-
redirect: "error",
|
|
112868
|
-
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(30000)]) : AbortSignal.timeout(30000)
|
|
112869
|
-
});
|
|
112870
|
-
} catch (error) {
|
|
112871
|
-
const cause = error instanceof Error && error.cause instanceof Error ? error.cause : error;
|
|
112872
|
-
const code = cause instanceof Error ? Reflect.get(cause, "code") : undefined;
|
|
112873
|
-
throw new RequestFailure(typeof code === "string" && [
|
|
112874
|
-
"ENOTFOUND",
|
|
112875
|
-
"ECONNREFUSED",
|
|
112876
|
-
"ENETUNREACH",
|
|
112877
|
-
"EHOSTUNREACH",
|
|
112878
|
-
"EAI_AGAIN",
|
|
112879
|
-
"ConnectionRefused",
|
|
112880
|
-
"EADDRNOTAVAIL",
|
|
112881
|
-
"ENETDOWN",
|
|
112882
|
-
"EHOSTDOWN",
|
|
112883
|
-
"UND_ERR_CONNECT_TIMEOUT",
|
|
112884
|
-
"ERR_TLS_HANDSHAKE_TIMEOUT",
|
|
112885
|
-
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
112886
|
-
"CERT_HAS_EXPIRED",
|
|
112887
|
-
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
112888
|
-
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
112889
|
-
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
112890
|
-
"CERT_NOT_YET_VALID",
|
|
112891
|
-
"UNABLE_TO_GET_ISSUER_CERT",
|
|
112892
|
-
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
112893
|
-
"CERT_SIGNATURE_FAILURE",
|
|
112894
|
-
"CERT_UNTRUSTED",
|
|
112895
|
-
"CERT_REJECTED"
|
|
112896
|
-
].includes(code));
|
|
112897
|
-
}
|
|
112898
|
-
if (response.status === 204)
|
|
112899
|
-
return null;
|
|
112900
|
-
try {
|
|
112901
|
-
body = await response.json();
|
|
112902
|
-
} catch {
|
|
112903
|
-
throw new RequestFailure(false, response.status);
|
|
112904
|
-
}
|
|
112905
|
-
if (response.ok)
|
|
112906
|
-
return body;
|
|
112907
|
-
const envelope = envelopeSchema.safeParse(body);
|
|
112908
|
-
if (!envelope.success)
|
|
112909
|
-
throw new InvalidApiResponse(response.status);
|
|
112910
|
-
const error = envelope.data.error;
|
|
112911
|
-
const detail = limitSchema.safeParse(error.detail);
|
|
112912
|
-
throw new ApiRefusal(error.code, response.status, error.code === "entitlement_required" && detail.success ? detail.data : undefined, response.headers.get("retry-after"));
|
|
112913
|
-
}
|
|
112914
112862
|
var jsonRequest = (body) => ({
|
|
112915
112863
|
method: "POST",
|
|
112916
112864
|
headers: { "content-type": "application/json" },
|
|
@@ -115363,6 +115311,100 @@ ${key.name}`;
|
|
|
115363
115311
|
// packages/omo-opencode/src/cli/service-auth/session.ts
|
|
115364
115312
|
import { homedir as homedir34 } from "os";
|
|
115365
115313
|
|
|
115314
|
+
// packages/device-service-core/src/local-only.ts
|
|
115315
|
+
var KEY2 = Symbol.for("omo.local-only-process.v1");
|
|
115316
|
+
function state3() {
|
|
115317
|
+
const holder = globalThis;
|
|
115318
|
+
holder[KEY2] ??= { marked: false };
|
|
115319
|
+
return holder[KEY2];
|
|
115320
|
+
}
|
|
115321
|
+
|
|
115322
|
+
class LocalOnlyNetworkRefused extends Error {
|
|
115323
|
+
code = "local_only_network_refused";
|
|
115324
|
+
site;
|
|
115325
|
+
constructor(site) {
|
|
115326
|
+
super(`a local-only omo remote command reached the network at ${site}`);
|
|
115327
|
+
this.site = site;
|
|
115328
|
+
}
|
|
115329
|
+
}
|
|
115330
|
+
function refuseIfLocalOnly(site) {
|
|
115331
|
+
if (state3().marked)
|
|
115332
|
+
throw new LocalOnlyNetworkRefused(site);
|
|
115333
|
+
}
|
|
115334
|
+
|
|
115335
|
+
// packages/omo-opencode/src/cli/service-auth/protocol-request.ts
|
|
115336
|
+
init_zod();
|
|
115337
|
+
class InvalidApiResponse extends SignInError {
|
|
115338
|
+
status;
|
|
115339
|
+
constructor(status) {
|
|
115340
|
+
super("The service returned an invalid error response.");
|
|
115341
|
+
this.status = status;
|
|
115342
|
+
}
|
|
115343
|
+
}
|
|
115344
|
+
var envelopeSchema = object({
|
|
115345
|
+
error: object({
|
|
115346
|
+
code: nonempty,
|
|
115347
|
+
message: string2(),
|
|
115348
|
+
retryable: boolean2(),
|
|
115349
|
+
requestId: string2(),
|
|
115350
|
+
detail: unknown().optional()
|
|
115351
|
+
})
|
|
115352
|
+
});
|
|
115353
|
+
async function requestApi(api, path, init, signal) {
|
|
115354
|
+
refuseIfLocalOnly("service-auth/protocol-request.ts requestApi");
|
|
115355
|
+
let response;
|
|
115356
|
+
let body;
|
|
115357
|
+
try {
|
|
115358
|
+
response = await fetch(`${api}${path}`, {
|
|
115359
|
+
...init,
|
|
115360
|
+
redirect: "error",
|
|
115361
|
+
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(30000)]) : AbortSignal.timeout(30000)
|
|
115362
|
+
});
|
|
115363
|
+
} catch (error) {
|
|
115364
|
+
const cause = error instanceof Error && error.cause instanceof Error ? error.cause : error;
|
|
115365
|
+
const code = cause instanceof Error ? Reflect.get(cause, "code") : undefined;
|
|
115366
|
+
throw new RequestFailure(typeof code === "string" && [
|
|
115367
|
+
"ENOTFOUND",
|
|
115368
|
+
"ECONNREFUSED",
|
|
115369
|
+
"ENETUNREACH",
|
|
115370
|
+
"EHOSTUNREACH",
|
|
115371
|
+
"EAI_AGAIN",
|
|
115372
|
+
"ConnectionRefused",
|
|
115373
|
+
"EADDRNOTAVAIL",
|
|
115374
|
+
"ENETDOWN",
|
|
115375
|
+
"EHOSTDOWN",
|
|
115376
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
115377
|
+
"ERR_TLS_HANDSHAKE_TIMEOUT",
|
|
115378
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
115379
|
+
"CERT_HAS_EXPIRED",
|
|
115380
|
+
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
115381
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
115382
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
115383
|
+
"CERT_NOT_YET_VALID",
|
|
115384
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
115385
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
115386
|
+
"CERT_SIGNATURE_FAILURE",
|
|
115387
|
+
"CERT_UNTRUSTED",
|
|
115388
|
+
"CERT_REJECTED"
|
|
115389
|
+
].includes(code));
|
|
115390
|
+
}
|
|
115391
|
+
if (response.status === 204)
|
|
115392
|
+
return null;
|
|
115393
|
+
try {
|
|
115394
|
+
body = await response.json();
|
|
115395
|
+
} catch {
|
|
115396
|
+
throw new RequestFailure(false, response.status);
|
|
115397
|
+
}
|
|
115398
|
+
if (response.ok)
|
|
115399
|
+
return body;
|
|
115400
|
+
const envelope = envelopeSchema.safeParse(body);
|
|
115401
|
+
if (!envelope.success)
|
|
115402
|
+
throw new InvalidApiResponse(response.status);
|
|
115403
|
+
const error = envelope.data.error;
|
|
115404
|
+
const detail = limitSchema.safeParse(error.detail);
|
|
115405
|
+
throw new ApiRefusal(error.code, response.status, error.code === "entitlement_required" && detail.success ? detail.data : undefined, response.headers.get("retry-after"));
|
|
115406
|
+
}
|
|
115407
|
+
|
|
115366
115408
|
// packages/omo-opencode/src/cli/service-auth/signed-out-marker.ts
|
|
115367
115409
|
init_zod();
|
|
115368
115410
|
import { mkdir as mkdir13, readFile as readFile38, rename as rename10, rm as rm19, writeFile as writeFile18 } from "fs/promises";
|
|
@@ -115437,6 +115479,7 @@ function createSession(options) {
|
|
|
115437
115479
|
}
|
|
115438
115480
|
if (Date.parse(current.accessTokenExpiresAt) > now() + 30000)
|
|
115439
115481
|
return current;
|
|
115482
|
+
refuseIfLocalOnly("service-auth/session.ts refresh");
|
|
115440
115483
|
await store.write({ ...current, refreshState: "uncertain" });
|
|
115441
115484
|
try {
|
|
115442
115485
|
const tokens = parseReply(tokenSchema, await request("/v1/session/refresh", jsonRequest({ refreshToken: current.refreshToken })));
|
|
@@ -116008,8 +116051,7 @@ function configureServiceAuthCommands(program, open = serviceAccountsOpen(), hoo
|
|
|
116008
116051
|
import { existsSync as existsSync68 } from "fs";
|
|
116009
116052
|
|
|
116010
116053
|
// packages/device-service-core/src/device-service.ts
|
|
116011
|
-
import {
|
|
116012
|
-
import { join as join120 } from "path";
|
|
116054
|
+
import { join as join121 } from "path";
|
|
116013
116055
|
|
|
116014
116056
|
// packages/device-service-core/src/local-api/access.ts
|
|
116015
116057
|
import { createHmac as createHmac2, randomBytes as randomBytes7, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
@@ -116518,7 +116560,8 @@ var ERROR_CODES = [
|
|
|
116518
116560
|
"method_unclassified",
|
|
116519
116561
|
"method_local_only",
|
|
116520
116562
|
"host_not_answering",
|
|
116521
|
-
"unsupported"
|
|
116563
|
+
"unsupported",
|
|
116564
|
+
"unknown_delivery"
|
|
116522
116565
|
];
|
|
116523
116566
|
var PATH_REFUSAL_PROBLEMS = [
|
|
116524
116567
|
"not_absolute",
|
|
@@ -116782,6 +116825,7 @@ var ATTACH_ID_MAX = 4294967295;
|
|
|
116782
116825
|
var MILLIS_MAX = Number.MAX_SAFE_INTEGER;
|
|
116783
116826
|
var deviceId = (v, what = "device") => text(v, SESSION_DEVICE_MAX_CHARS, what);
|
|
116784
116827
|
var sessionId = (v) => text(v, SESSION_ID_MAX_CHARS, "session_id");
|
|
116828
|
+
var durableId = (v, what = "durable_id") => text(v, SESSION_ID_MAX_CHARS, what);
|
|
116785
116829
|
var attachId = (v) => uint(v, 1, ATTACH_ID_MAX, "attach_id");
|
|
116786
116830
|
var millis = (v, what) => uint(v, 0, MILLIS_MAX, what);
|
|
116787
116831
|
var deviceRef = (v, what = "device", fields = exactly) => {
|
|
@@ -117214,6 +117258,94 @@ var DELEGATED_EVENT_VALIDATORS = {
|
|
|
117214
117258
|
}
|
|
117215
117259
|
};
|
|
117216
117260
|
|
|
117261
|
+
// packages/device-service-core/src/local-api/validate-deliveries.ts
|
|
117262
|
+
var PROTOCOL_MAX = 1e6;
|
|
117263
|
+
var PAIRS_MAX = 4096;
|
|
117264
|
+
var pairOf = (m) => ({
|
|
117265
|
+
sender_device: deviceId(m["sender_device"], "sender_device"),
|
|
117266
|
+
session_id: durableId(m["session_id"], "session_id"),
|
|
117267
|
+
last_command_id: commandId(m["last_command_id"])
|
|
117268
|
+
});
|
|
117269
|
+
var PAIR_FIELDS = ["sender_device", "session_id", "last_command_id"];
|
|
117270
|
+
var DELIVERIES_REQUEST_VALIDATORS = {
|
|
117271
|
+
"delivery.pending": (v, id) => {
|
|
117272
|
+
const pairs = requestFields(v, ["pairs"])["pairs"];
|
|
117273
|
+
if (!Array.isArray(pairs) || pairs.length > PAIRS_MAX)
|
|
117274
|
+
return fail("pairs");
|
|
117275
|
+
return { id, type: "delivery.pending", pairs: pairs.map((p) => pairOf(exactly(p, PAIR_FIELDS, [], "pair"))) };
|
|
117276
|
+
},
|
|
117277
|
+
"delivery.drained": (v, id) => ({ id, type: "delivery.drained", ...pairOf(requestFields(v, PAIR_FIELDS)) }),
|
|
117278
|
+
"deliveries.serve": (v, id) => {
|
|
117279
|
+
const m = requestFields(v, ["agent_dir", "v"]);
|
|
117280
|
+
return {
|
|
117281
|
+
id,
|
|
117282
|
+
type: "deliveries.serve",
|
|
117283
|
+
agent_dir: absolutePath(m["agent_dir"], "agent_dir"),
|
|
117284
|
+
v: uint(m["v"], 0, PROTOCOL_MAX, "v")
|
|
117285
|
+
};
|
|
117286
|
+
},
|
|
117287
|
+
"delivery.answer": (v, id) => {
|
|
117288
|
+
const m = requestFields(v, ["sender_device", "command_id", "reply"]);
|
|
117289
|
+
return {
|
|
117290
|
+
id,
|
|
117291
|
+
type: "delivery.answer",
|
|
117292
|
+
sender_device: deviceId(m["sender_device"], "sender_device"),
|
|
117293
|
+
command_id: commandId(m["command_id"]),
|
|
117294
|
+
reply: jsonObject(m["reply"], "reply")
|
|
117295
|
+
};
|
|
117296
|
+
},
|
|
117297
|
+
"delivery.held": (v, id) => {
|
|
117298
|
+
const m = requestFields(v, ["ask_id", "holds"]);
|
|
117299
|
+
return { id, type: "delivery.held", ask_id: localId(m["ask_id"], "ask_id"), holds: bool(m["holds"], "holds") };
|
|
117300
|
+
},
|
|
117301
|
+
"peer.admitted": (v, id) => ({ id, type: "peer.admitted", device: deviceId(requestFields(v, ["device"])["device"]) })
|
|
117302
|
+
};
|
|
117303
|
+
var empty = (v) => {
|
|
117304
|
+
known(v, [], [], "data");
|
|
117305
|
+
return {};
|
|
117306
|
+
};
|
|
117307
|
+
var DELIVERIES_DATA = {
|
|
117308
|
+
"deliveries.serve": (v) => ({ wake: bool(known(v, ["wake"], [], "data")["wake"], "wake") }),
|
|
117309
|
+
"delivery.answer": empty,
|
|
117310
|
+
"delivery.held": empty,
|
|
117311
|
+
"delivery.pending": empty,
|
|
117312
|
+
"delivery.drained": (v) => {
|
|
117313
|
+
const m = known(v, ["kept"], ["expecting"], "data");
|
|
117314
|
+
const kept = bool(m["kept"], "kept");
|
|
117315
|
+
if (!kept)
|
|
117316
|
+
return m["expecting"] === undefined ? { kept } : fail("expecting");
|
|
117317
|
+
return { kept, expecting: commandId(m["expecting"]) };
|
|
117318
|
+
},
|
|
117319
|
+
"peer.admitted": (v) => ({ admitted: bool(known(v, ["admitted"], [], "data")["admitted"], "admitted") })
|
|
117320
|
+
};
|
|
117321
|
+
var DELIVERIES_EVENT_VALIDATORS = {
|
|
117322
|
+
"delivery.wake": (v) => ({
|
|
117323
|
+
type: "event",
|
|
117324
|
+
kind: "delivery.wake",
|
|
117325
|
+
enabled: bool(eventFields(v, ["enabled"])["enabled"], "enabled")
|
|
117326
|
+
}),
|
|
117327
|
+
"delivery.inbound": (v) => {
|
|
117328
|
+
const m = eventFields(v, ["command_id", "sender_device", "durable_id", "record"]);
|
|
117329
|
+
return {
|
|
117330
|
+
type: "event",
|
|
117331
|
+
kind: "delivery.inbound",
|
|
117332
|
+
command_id: commandId(m["command_id"]),
|
|
117333
|
+
sender_device: deviceId(m["sender_device"], "sender_device"),
|
|
117334
|
+
durable_id: durableId(m["durable_id"]),
|
|
117335
|
+
record: jsonObject(m["record"], "record")
|
|
117336
|
+
};
|
|
117337
|
+
},
|
|
117338
|
+
"delivery.holds": (v) => {
|
|
117339
|
+
const m = eventFields(v, ["ask_id", "durable_id"]);
|
|
117340
|
+
return {
|
|
117341
|
+
type: "event",
|
|
117342
|
+
kind: "delivery.holds",
|
|
117343
|
+
ask_id: localId(m["ask_id"], "ask_id"),
|
|
117344
|
+
durable_id: durableId(m["durable_id"])
|
|
117345
|
+
};
|
|
117346
|
+
}
|
|
117347
|
+
};
|
|
117348
|
+
|
|
117217
117349
|
// packages/device-service-core/src/local-api/validate-events.ts
|
|
117218
117350
|
var revisionOf = (m) => uint(m["revision"], 1, Number.MAX_SAFE_INTEGER, "revision");
|
|
117219
117351
|
var devicesOf = (v) => {
|
|
@@ -117265,6 +117397,7 @@ var commandStateOf = (v) => {
|
|
|
117265
117397
|
var VALIDATORS = {
|
|
117266
117398
|
...STREAM_EVENT_VALIDATORS,
|
|
117267
117399
|
...DELEGATED_EVENT_VALIDATORS,
|
|
117400
|
+
...DELIVERIES_EVENT_VALIDATORS,
|
|
117268
117401
|
"status.changed": (v) => ({
|
|
117269
117402
|
type: "event",
|
|
117270
117403
|
kind: "status.changed",
|
|
@@ -117395,6 +117528,7 @@ var agentDir = (v) => absolutePath(requestFields(v, ["agent_dir"])["agent_dir"],
|
|
|
117395
117528
|
var VALIDATORS2 = {
|
|
117396
117529
|
...COMMAND_REQUEST_VALIDATORS,
|
|
117397
117530
|
...DELEGATED_REQUEST_VALIDATORS,
|
|
117531
|
+
...DELIVERIES_REQUEST_VALIDATORS,
|
|
117398
117532
|
authenticate: (v, id) => {
|
|
117399
117533
|
const m = requestFields(v, ["client_proof"]);
|
|
117400
117534
|
return { id, type: "authenticate", client_proof: text(m["client_proof"], 64, "client_proof") };
|
|
@@ -117407,6 +117541,15 @@ var VALIDATORS2 = {
|
|
|
117407
117541
|
bare(v);
|
|
117408
117542
|
return { id, type: "status.subscribe" };
|
|
117409
117543
|
},
|
|
117544
|
+
"control.session_wake.get": (v, id) => {
|
|
117545
|
+
bare(v);
|
|
117546
|
+
return { id, type: "control.session_wake.get" };
|
|
117547
|
+
},
|
|
117548
|
+
"control.session_wake.set": (v, id) => {
|
|
117549
|
+
const value = requestFields(v, ["enabled"])["enabled"];
|
|
117550
|
+
const enabled = value === null || typeof value === "boolean" ? value : fail("enabled");
|
|
117551
|
+
return { id, type: "control.session_wake.set", enabled };
|
|
117552
|
+
},
|
|
117410
117553
|
"control.attach.get": (v, id) => {
|
|
117411
117554
|
bare(v);
|
|
117412
117555
|
return { id, type: "control.attach.get" };
|
|
@@ -117543,7 +117686,7 @@ var validateWelcome = (v) => asViolation(() => {
|
|
|
117543
117686
|
state: statusOf(m["state"])
|
|
117544
117687
|
};
|
|
117545
117688
|
});
|
|
117546
|
-
var
|
|
117689
|
+
var empty2 = (v) => {
|
|
117547
117690
|
known(v, [], [], "data");
|
|
117548
117691
|
return {};
|
|
117549
117692
|
};
|
|
@@ -117556,35 +117699,49 @@ var attachState = (v) => {
|
|
|
117556
117699
|
changedAt: typeof changedAt === "string" ? changedAt : fail("changedAt")
|
|
117557
117700
|
};
|
|
117558
117701
|
};
|
|
117702
|
+
var sessionWakeState = (v) => {
|
|
117703
|
+
const m = known(v, ["enabled", "stored", "changedAt", "overridden"], [], "data");
|
|
117704
|
+
const s = m["stored"];
|
|
117705
|
+
const changedAt = m["changedAt"];
|
|
117706
|
+
return {
|
|
117707
|
+
enabled: bool(m["enabled"], "enabled"),
|
|
117708
|
+
stored: s === null || typeof s === "boolean" ? s : s === "unreadable" ? "unreadable" : fail("stored"),
|
|
117709
|
+
changedAt: typeof changedAt === "string" ? changedAt : fail("changedAt"),
|
|
117710
|
+
overridden: bool(m["overridden"], "overridden")
|
|
117711
|
+
};
|
|
117712
|
+
};
|
|
117559
117713
|
var DATA = {
|
|
117560
|
-
authenticate:
|
|
117714
|
+
authenticate: empty2,
|
|
117561
117715
|
"status.get": statusOf,
|
|
117562
|
-
"status.subscribe":
|
|
117716
|
+
"status.subscribe": empty2,
|
|
117563
117717
|
"service.set_enabled": (v) => ({ enabled: bool(one(v, "enabled"), "enabled") }),
|
|
117564
|
-
"refresher.register":
|
|
117718
|
+
"refresher.register": empty2,
|
|
117565
117719
|
"device.adopt": (v) => ({ device: deviceRef(one(v, "device"), "device", known) }),
|
|
117566
|
-
"device.forget":
|
|
117720
|
+
"device.forget": empty2,
|
|
117567
117721
|
"device.info": (v) => ({
|
|
117568
117722
|
device: nullable2(one(v, "device"), (d) => deviceRef(d, "device", known))
|
|
117569
117723
|
}),
|
|
117570
|
-
"endpoints.register":
|
|
117571
|
-
"endpoints.unregister":
|
|
117724
|
+
"endpoints.register": empty2,
|
|
117725
|
+
"endpoints.unregister": empty2,
|
|
117572
117726
|
"devices.list": (v) => {
|
|
117573
117727
|
const devices = one(v, "devices");
|
|
117574
117728
|
return Array.isArray(devices) ? { devices: devices.map(deviceRowOf) } : fail("devices");
|
|
117575
117729
|
},
|
|
117576
117730
|
"sessions.list": (v) => ({ query_id: localId(one(v, "query_id"), "query_id") }),
|
|
117577
117731
|
"session.attach": (v) => ({ attach: localId(one(v, "attach"), "attach") }),
|
|
117578
|
-
"session.detach":
|
|
117732
|
+
"session.detach": empty2,
|
|
117579
117733
|
"session.command": (v) => ({ command_id: commandId(one(v, "command_id")) }),
|
|
117580
117734
|
"session.command_part": (v) => ({
|
|
117581
117735
|
received: uint(one(v, "received"), 0, LOCAL_UPLOAD_PARTS_MAX - 1, "received")
|
|
117582
117736
|
}),
|
|
117583
117737
|
"session.read": (v) => ({ query_id: localId(one(v, "query_id"), "query_id") }),
|
|
117584
|
-
"enforcement.report":
|
|
117585
|
-
"owner.shutdown_for_upgrade":
|
|
117738
|
+
"enforcement.report": empty2,
|
|
117739
|
+
"owner.shutdown_for_upgrade": empty2,
|
|
117586
117740
|
"session.endpoints": endpointsData,
|
|
117587
117741
|
"session.locate": locateData,
|
|
117742
|
+
...DELIVERIES_DATA,
|
|
117743
|
+
"control.session_wake.get": sessionWakeState,
|
|
117744
|
+
"control.session_wake.set": sessionWakeState,
|
|
117588
117745
|
"control.attach.get": attachState,
|
|
117589
117746
|
"control.attach.set": attachState
|
|
117590
117747
|
};
|
|
@@ -117673,6 +117830,9 @@ class EventAssembler {
|
|
|
117673
117830
|
case "session.command_blob_chunk":
|
|
117674
117831
|
case "session.command_blob_done":
|
|
117675
117832
|
case "session.channel_closed":
|
|
117833
|
+
case "delivery.inbound":
|
|
117834
|
+
case "delivery.holds":
|
|
117835
|
+
case "delivery.wake":
|
|
117676
117836
|
return;
|
|
117677
117837
|
default:
|
|
117678
117838
|
return assertNever(event);
|
|
@@ -118098,7 +118258,8 @@ var handshake = (connection, options) => new Promise((resolve, reject) => {
|
|
|
118098
118258
|
}, HANDSHAKE_TIMEOUT_MS);
|
|
118099
118259
|
proveAndAuthenticate(connection, options).then(resolve, reject).finally(cancel);
|
|
118100
118260
|
});
|
|
118101
|
-
var sendCommand = async (connection, attach, rpc, command_id, route) => {
|
|
118261
|
+
var sendCommand = async (connection, attach, rpc, command_id, route, accepts) => {
|
|
118262
|
+
const marked = accepts === undefined ? {} : { accepts };
|
|
118102
118263
|
const sent = command_id ?? mintId();
|
|
118103
118264
|
const id = { command_id: sent };
|
|
118104
118265
|
const timedOut = (error) => {
|
|
@@ -118125,9 +118286,26 @@ var sendCommand = async (connection, attach, rpc, command_id, route) => {
|
|
|
118125
118286
|
const upload_id = mintId();
|
|
118126
118287
|
const parts = uploadParts(json).map((part) => connection.request("session.command_part", { attach, upload_id, ...part }));
|
|
118127
118288
|
await Promise.all(parts);
|
|
118128
|
-
return (await connection.request("session.command", { attach, ...id, ...route, upload_id }).catch(timedOut)).command_id;
|
|
118289
|
+
return (await connection.request("session.command", { attach, ...id, ...marked, ...route, upload_id }).catch(timedOut)).command_id;
|
|
118290
|
+
}
|
|
118291
|
+
return (await connection.request("session.command", { attach, ...id, ...marked, ...route, rpc }).catch(timedOut)).command_id;
|
|
118292
|
+
};
|
|
118293
|
+
var sendWakeCommand = async (connection, device, durableId, rpc, command_id) => {
|
|
118294
|
+
const sent = command_id ?? mintId();
|
|
118295
|
+
const params = { wake: { device, durable_id: durableId }, command_id: sent, rpc };
|
|
118296
|
+
if (lineBytes({ id: "x".repeat(REQUEST_ID_MAX_CHARS), type: "session.command", ...params }) > LOCAL_INLINE_MAX)
|
|
118297
|
+
throw new LocalApiError("message_too_long", "a wake command travels inline only", {
|
|
118298
|
+
limit_chars: MESSAGE_LIMIT_CHARS
|
|
118299
|
+
});
|
|
118300
|
+
try {
|
|
118301
|
+
return (await connection.request("session.command", params)).command_id;
|
|
118302
|
+
} catch (error) {
|
|
118303
|
+
if (error instanceof LocalApiError && error.code === "request_timeout")
|
|
118304
|
+
throw new LocalApiError("request_timeout", `command ${sent} may have been dispatched; follow its command state`, {
|
|
118305
|
+
command_id: sent
|
|
118306
|
+
});
|
|
118307
|
+
throw error;
|
|
118129
118308
|
}
|
|
118130
|
-
return (await connection.request("session.command", { attach, ...id, ...route, rpc }).catch(timedOut)).command_id;
|
|
118131
118309
|
};
|
|
118132
118310
|
var sendEndpointCommand = async (connection, device, endpoint, rpc, command_id, locate) => {
|
|
118133
118311
|
const sent = command_id ?? mintId();
|
|
@@ -118170,7 +118348,8 @@ var connectLocalApi = async (options) => {
|
|
|
118170
118348
|
listeners.delete(listener);
|
|
118171
118349
|
};
|
|
118172
118350
|
},
|
|
118173
|
-
command: (attach, rpc, command_id, route = {}) => sendCommand(connection, attach, rpc, command_id, route),
|
|
118351
|
+
command: (attach, rpc, command_id, route = {}, options) => sendCommand(connection, attach, rpc, command_id, route, options?.accepts),
|
|
118352
|
+
wakeCommand: (device, durableId, rpc, command_id) => sendWakeCommand(connection, device, durableId, rpc, command_id),
|
|
118174
118353
|
endpointCommand: (device, endpoint, rpc, command_id, options) => sendEndpointCommand(connection, device, endpoint, rpc, command_id, options?.locate === true),
|
|
118175
118354
|
list: (filter, onRevision, rows) => new Promise((resolve, reject) => {
|
|
118176
118355
|
const params = {
|
|
@@ -118439,7 +118618,7 @@ function openAttach(client, device, sessionId) {
|
|
|
118439
118618
|
failure: () => failure,
|
|
118440
118619
|
onFrame: (listener) => delegated.onFrame(listener),
|
|
118441
118620
|
onChannelLoss: (listener) => delegated.onLoss(listener),
|
|
118442
|
-
command: (rpc) => new Promise((resolve, reject) => {
|
|
118621
|
+
command: (rpc, options) => new Promise((resolve, reject) => {
|
|
118443
118622
|
if (ended)
|
|
118444
118623
|
return reject(new Error("the attach has ended"));
|
|
118445
118624
|
const commandId = randomBytes8(16).toString("base64url");
|
|
@@ -118463,7 +118642,7 @@ function openAttach(client, device, sessionId) {
|
|
|
118463
118642
|
resolve(response === undefined ? { outcome: event } : { outcome: event, response });
|
|
118464
118643
|
});
|
|
118465
118644
|
commands.add(end);
|
|
118466
|
-
client.command(attach, rpc, commandId, { delegated: true }).catch((error) => {
|
|
118645
|
+
client.command(attach, rpc, commandId, { delegated: true }, options).catch((error) => {
|
|
118467
118646
|
settle();
|
|
118468
118647
|
reject(error);
|
|
118469
118648
|
});
|
|
@@ -118507,6 +118686,9 @@ function newestRowsListing(client) {
|
|
|
118507
118686
|
// packages/device-service-core/src/device-service.ts
|
|
118508
118687
|
import { randomBytes as randomBytes9 } from "crypto";
|
|
118509
118688
|
|
|
118689
|
+
// packages/device-service-core/src/minimum-in-effect.ts
|
|
118690
|
+
var minimumInEffect = (option, key, shipped) => option === undefined ? shipped : option[key];
|
|
118691
|
+
|
|
118510
118692
|
// packages/device-service-core/src/release/version.ts
|
|
118511
118693
|
var SEMVER2 = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
118512
118694
|
var compareIdentifier = (a, b) => {
|
|
@@ -118543,9 +118725,49 @@ var compareVersions4 = (a, b) => {
|
|
|
118543
118725
|
}
|
|
118544
118726
|
return 0;
|
|
118545
118727
|
};
|
|
118728
|
+
|
|
118729
|
+
// packages/device-service-core/src/state-dir.ts
|
|
118730
|
+
import { readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
118731
|
+
import { homedir as homedir36 } from "os";
|
|
118732
|
+
import { dirname as dirname49, join as join120, posix as posix17, win32 as win3212 } from "path";
|
|
118733
|
+
var DEVICE_SERVICE_STATE_DIR_ENV = "OMO_DEVICE_SERVICE_STATE_DIR";
|
|
118734
|
+
var LOCATION_FILE = "device-service.location.json";
|
|
118735
|
+
var isAbsoluteOn = (platform, path) => (platform === "win32" ? win3212 : posix17).isAbsolute(path);
|
|
118736
|
+
function defaultStateDir(platform, env, home) {
|
|
118737
|
+
if (platform !== "win32")
|
|
118738
|
+
return join120(home, ".omo", "device-service");
|
|
118739
|
+
const localAppData = env.LOCALAPPDATA ?? join120(home, "AppData", "Local");
|
|
118740
|
+
return join120(localAppData, "OmO", "device-service");
|
|
118741
|
+
}
|
|
118742
|
+
function discoveredStateDir(platform, defaultDir) {
|
|
118743
|
+
try {
|
|
118744
|
+
const parsed = JSON.parse(readFileSync48(join120(dirname49(defaultDir), LOCATION_FILE), "utf8"));
|
|
118745
|
+
if (typeof parsed !== "object" || parsed === null || !("v" in parsed) || !("state_dir" in parsed))
|
|
118746
|
+
return;
|
|
118747
|
+
const { v, state_dir: stateDir } = parsed;
|
|
118748
|
+
if (v !== 1 || typeof stateDir !== "string" || !isAbsoluteOn(platform, stateDir))
|
|
118749
|
+
return;
|
|
118750
|
+
return statSync10(stateDir).isDirectory() ? stateDir : undefined;
|
|
118751
|
+
} catch {
|
|
118752
|
+
return;
|
|
118753
|
+
}
|
|
118754
|
+
}
|
|
118755
|
+
function deviceServiceStateDir(platform = process.platform, env = process.env, home = homedir36()) {
|
|
118756
|
+
const explicit = env[DEVICE_SERVICE_STATE_DIR_ENV];
|
|
118757
|
+
if (explicit !== undefined && explicit !== "" && isAbsoluteOn(platform, explicit))
|
|
118758
|
+
return explicit;
|
|
118759
|
+
const defaultDir = defaultStateDir(platform, env, home);
|
|
118760
|
+
return discoveredStateDir(platform, defaultDir) ?? defaultDir;
|
|
118761
|
+
}
|
|
118546
118762
|
// packages/device-service-core/src/device-service.ts
|
|
118547
118763
|
var ENDPOINT_COMMAND_WAIT_MS = 120000;
|
|
118548
118764
|
function sendToEndpoint(client, device, endpoint, rpc, locate) {
|
|
118765
|
+
return followDelegatedCommand(client, device, (commandId) => {
|
|
118766
|
+
const send = (asked) => client.endpointCommand(device, endpoint, rpc, commandId, { locate: asked });
|
|
118767
|
+
return send(locate).catch((error) => locate && error instanceof LocalApiError && error.code === "invalid_request" ? send(false) : Promise.reject(error));
|
|
118768
|
+
});
|
|
118769
|
+
}
|
|
118770
|
+
function followDelegatedCommand(client, device, send) {
|
|
118549
118771
|
return new Promise((resolve, reject) => {
|
|
118550
118772
|
const commandId = randomBytes9(16).toString("base64url");
|
|
118551
118773
|
const channel = followDelegatedChannel(device);
|
|
@@ -118580,8 +118802,7 @@ function sendToEndpoint(client, device, endpoint, rpc, locate) {
|
|
|
118580
118802
|
const timer = setTimeout(() => fail(new Error(`no final state for endpoint command ${commandId} within ${ENDPOINT_COMMAND_WAIT_MS} ms`)), ENDPOINT_COMMAND_WAIT_MS);
|
|
118581
118803
|
timer.unref?.();
|
|
118582
118804
|
client.closed.then(() => fail(new Error("the connection closed before the endpoint command settled")));
|
|
118583
|
-
|
|
118584
|
-
send(locate).catch((error) => locate && error instanceof LocalApiError && error.code === "invalid_request" ? send(false).catch(fail) : fail(error));
|
|
118805
|
+
send(commandId).catch(fail);
|
|
118585
118806
|
});
|
|
118586
118807
|
}
|
|
118587
118808
|
var markNotSent = (error) => error instanceof LocalApiError ? new LocalApiError(error.code, error.reason, {
|
|
@@ -118590,17 +118811,14 @@ var markNotSent = (error) => error instanceof LocalApiError ? new LocalApiError(
|
|
|
118590
118811
|
...error.path_refusal === undefined ? {} : { path_refusal: error.path_refusal },
|
|
118591
118812
|
not_sent: true
|
|
118592
118813
|
}) : error;
|
|
118593
|
-
function deviceServiceStateDir(platform = process.platform, env = process.env, home = homedir36()) {
|
|
118594
|
-
if (platform !== "win32")
|
|
118595
|
-
return join120(home, ".omo", "device-service");
|
|
118596
|
-
const localAppData = env.LOCALAPPDATA ?? join120(home, "AppData", "Local");
|
|
118597
|
-
return join120(localAppData, "OmO", "device-service");
|
|
118598
|
-
}
|
|
118599
118814
|
function deviceServiceEndpointPath(stateDir, platform = process.platform) {
|
|
118600
|
-
return
|
|
118815
|
+
return join121(stateDir, platform === "win32" ? ENDPOINT_FILE : SOCKET_FILE);
|
|
118601
118816
|
}
|
|
118602
118817
|
var ADOPT_ACCOUNT_MIN_SERVICE_VERSION = "0.1.3";
|
|
118603
118818
|
var acceptsAdoptAccount = (serviceVersion) => compareVersions4(serviceVersion, ADOPT_ACCOUNT_MIN_SERVICE_VERSION) >= 0;
|
|
118819
|
+
var WAKE_MARK_MIN_SERVICE_VERSION = "0.1.31";
|
|
118820
|
+
var LOCATE_SINGLE_MIN_SERVICE_VERSION = "0.1.13";
|
|
118821
|
+
var serviceAtLeast = (serviceVersion, minimum) => minimum !== null && compareVersions4(serviceVersion, minimum) >= 0;
|
|
118604
118822
|
async function connectDeviceService(options) {
|
|
118605
118823
|
const stateDir = options.stateDir ?? deviceServiceStateDir();
|
|
118606
118824
|
const client = await (options.connect ?? connectLocalApi)({
|
|
@@ -118608,8 +118826,14 @@ async function connectDeviceService(options) {
|
|
|
118608
118826
|
client: { name: "omo", version: options.version },
|
|
118609
118827
|
...options.background === true ? { transport: () => connectLocal(stateDir, { background: true }) } : {}
|
|
118610
118828
|
});
|
|
118829
|
+
const wakeMarkMinimum = minimumInEffect(options.minimums, "wakeMark", WAKE_MARK_MIN_SERVICE_VERSION);
|
|
118830
|
+
const carriesWakeMark = serviceAtLeast(client.welcome.service_version, wakeMarkMinimum);
|
|
118831
|
+
const takesSingleLocate = serviceAtLeast(client.welcome.service_version, minimumInEffect(options.minimums, "singleLocate", LOCATE_SINGLE_MIN_SERVICE_VERSION));
|
|
118611
118832
|
return {
|
|
118612
118833
|
serviceVersion: client.welcome.service_version,
|
|
118834
|
+
carriesWakeMark,
|
|
118835
|
+
wakeMarkMinimum,
|
|
118836
|
+
takesSingleLocate,
|
|
118613
118837
|
capabilities: client.welcome.capabilities,
|
|
118614
118838
|
initialStatus: client.welcome.state,
|
|
118615
118839
|
status: () => client.request("status.get", {}),
|
|
@@ -118627,6 +118851,8 @@ async function connectDeviceService(options) {
|
|
|
118627
118851
|
return stop;
|
|
118628
118852
|
},
|
|
118629
118853
|
setEnabled: async (enabled) => (await client.request("service.set_enabled", { enabled })).enabled,
|
|
118854
|
+
sessionWake: () => client.request("control.session_wake.get", {}),
|
|
118855
|
+
setSessionWake: (enabled) => client.request("control.session_wake.set", { enabled }),
|
|
118630
118856
|
attachControl: () => client.request("control.attach.get", {}),
|
|
118631
118857
|
setAttachControl: (attached) => client.request("control.attach.set", { attached }),
|
|
118632
118858
|
registerRefresher: async (binaryPath, version) => {
|
|
@@ -118647,7 +118873,10 @@ async function connectDeviceService(options) {
|
|
|
118647
118873
|
thisDevice: async () => (await client.request("device.info", {})).device,
|
|
118648
118874
|
devices: async () => (await client.request("devices.list", {})).devices,
|
|
118649
118875
|
sessions: newestRowsListing(client),
|
|
118650
|
-
attach: (device, sessionId) =>
|
|
118876
|
+
attach: async (device, sessionId) => {
|
|
118877
|
+
const attached = await openAttach(client, device, sessionId);
|
|
118878
|
+
return carriesWakeMark ? attached : { ...attached, command: (rpc) => attached.command(rpc) };
|
|
118879
|
+
},
|
|
118651
118880
|
endpointCommand: async (device, rpc, options) => {
|
|
118652
118881
|
let endpoint;
|
|
118653
118882
|
try {
|
|
@@ -118661,7 +118890,18 @@ async function connectDeviceService(options) {
|
|
|
118661
118890
|
},
|
|
118662
118891
|
close: () => client.close(),
|
|
118663
118892
|
closed: client.closed,
|
|
118664
|
-
locate: (device, engineId) => client.request("session.locate", {
|
|
118893
|
+
locate: (device, engineId, options) => client.request("session.locate", {
|
|
118894
|
+
device,
|
|
118895
|
+
engine_id: engineId,
|
|
118896
|
+
...options?.single === true && takesSingleLocate ? { single: true } : {}
|
|
118897
|
+
}),
|
|
118898
|
+
wakeCommand: async (device, durableId, rpc) => {
|
|
118899
|
+
if (!carriesWakeMark)
|
|
118900
|
+
throw new LocalApiError("unsupported", "this device service does not carry the wake target", { not_sent: true });
|
|
118901
|
+
return await followDelegatedCommand(client, device, (commandId) => client.wakeCommand(device, durableId, rpc, commandId).catch((error) => {
|
|
118902
|
+
throw error instanceof LocalApiError && error.command_id === undefined ? markNotSent(error) : error;
|
|
118903
|
+
}));
|
|
118904
|
+
}
|
|
118665
118905
|
};
|
|
118666
118906
|
}
|
|
118667
118907
|
// packages/device-service-core/src/bootstrap.ts
|
|
@@ -118724,6 +118964,11 @@ var forgetDeviceService = async (options) => {
|
|
|
118724
118964
|
}
|
|
118725
118965
|
return "forgotten";
|
|
118726
118966
|
};
|
|
118967
|
+
// packages/device-service-core/src/cold-wake/service-table.ts
|
|
118968
|
+
var SERVICE_TABLE_ENV = "OMO_RELAYD_SERVICES";
|
|
118969
|
+
|
|
118970
|
+
// packages/device-service-core/src/cold-wake/darwin.ts
|
|
118971
|
+
var TABLE_KEY = `EnvironmentVariables.${SERVICE_TABLE_ENV}`;
|
|
118727
118972
|
// packages/device-service-core/src/release/release-assets.ts
|
|
118728
118973
|
var MANIFEST = "latest.json";
|
|
118729
118974
|
var CHECKSUMS_MAX_BYTES = 64 * 1024;
|
|
@@ -118795,7 +119040,7 @@ var NONE2 = Symbol("none registered");
|
|
|
118795
119040
|
// packages/omo-native/package.json
|
|
118796
119041
|
var package_default4 = {
|
|
118797
119042
|
name: "omo-ai",
|
|
118798
|
-
version: "5.1.
|
|
119043
|
+
version: "5.1.72",
|
|
118799
119044
|
type: "module",
|
|
118800
119045
|
description: "OmO Native - the standalone omo command with the OMO extension built in: bun add -g omo-ai",
|
|
118801
119046
|
bin: {
|
|
@@ -118812,7 +119057,7 @@ var package_default4 = {
|
|
|
118812
119057
|
postinstall: "node bin/senpi-patch.mjs"
|
|
118813
119058
|
},
|
|
118814
119059
|
dependencies: {
|
|
118815
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
119060
|
+
"@code-yeongyu/senpi": "2026.11.15-2"
|
|
118816
119061
|
},
|
|
118817
119062
|
repository: {
|
|
118818
119063
|
type: "git",
|
|
@@ -118825,6 +119070,7 @@ var isRecord20 = (value) => typeof value === "object" && value !== null;
|
|
|
118825
119070
|
async function accountOf(api, credentials, doFetch) {
|
|
118826
119071
|
if (credentials.accountId !== undefined)
|
|
118827
119072
|
return credentials.accountId;
|
|
119073
|
+
refuseIfLocalOnly("omo-native/device-service-handoff.ts accountOf");
|
|
118828
119074
|
const response = await doFetch(`${api}/v1/me`, { headers: { authorization: `Bearer ${credentials.accessToken}` } });
|
|
118829
119075
|
if (!response.ok)
|
|
118830
119076
|
throw new Error(`the account read failed (${response.status})`);
|
|
@@ -119106,7 +119352,7 @@ async function boulder(options) {
|
|
|
119106
119352
|
}
|
|
119107
119353
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
119108
119354
|
import { spawn as spawn7 } from "child_process";
|
|
119109
|
-
import { existsSync as existsSync70, readFileSync as
|
|
119355
|
+
import { existsSync as existsSync70, readFileSync as readFileSync49, realpathSync as realpathSync14 } from "fs";
|
|
119110
119356
|
import { homedir as homedir37 } from "os";
|
|
119111
119357
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
119112
119358
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
@@ -119156,7 +119402,7 @@ function resolveLegacyLocalOmoBin(env, homeDir, currentExecutablePaths) {
|
|
|
119156
119402
|
}
|
|
119157
119403
|
function isGeneratedRuntimeWrapper(candidate) {
|
|
119158
119404
|
try {
|
|
119159
|
-
return
|
|
119405
|
+
return readFileSync49(candidate, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
119160
119406
|
} catch (error) {
|
|
119161
119407
|
if (error instanceof Error)
|
|
119162
119408
|
return false;
|
|
@@ -119591,7 +119837,7 @@ prunes.
|
|
|
119591
119837
|
|
|
119592
119838
|
// packages/omo-opencode/src/cli/config-migrate.ts
|
|
119593
119839
|
init_startup_migration();
|
|
119594
|
-
import { posix as
|
|
119840
|
+
import { posix as posix18 } from "path";
|
|
119595
119841
|
function reports(result) {
|
|
119596
119842
|
return result.results.map((entry) => ({
|
|
119597
119843
|
diagnostics: entry.diagnostics,
|
|
@@ -119625,7 +119871,7 @@ function runConfigMigrate(options = {}) {
|
|
|
119625
119871
|
dryRun: options.dryRun ?? false,
|
|
119626
119872
|
environment,
|
|
119627
119873
|
...homeDir === undefined ? {} : { env: { HOME: homeDir }, homeDir },
|
|
119628
|
-
pathOperations:
|
|
119874
|
+
pathOperations: posix18
|
|
119629
119875
|
});
|
|
119630
119876
|
const report = reports(result);
|
|
119631
119877
|
const response = {
|