happy-imou-cloud 2.1.12 → 2.1.14
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/{BaseReasoningProcessor-yYne8hbQ.cjs → BaseReasoningProcessor-BopJzCX1.cjs} +2 -2
- package/dist/{BaseReasoningProcessor-DgKkEyg_.mjs → BaseReasoningProcessor-DBI-wmAq.mjs} +2 -2
- package/dist/{ProviderSelectionHandler-CxLijFCe.mjs → ProviderSelectionHandler-BBhFPe8E.mjs} +2 -2
- package/dist/{ProviderSelectionHandler-CARO_dnJ.cjs → ProviderSelectionHandler-D-g808TK.cjs} +2 -2
- package/dist/{api-CwRFeZQw.cjs → api-CleaBHoF.cjs} +48 -3
- package/dist/{api-0mR8QJK2.mjs → api-ehyDSOc5.mjs} +48 -3
- package/dist/{command-0ypdkfyo.cjs → command-jYweihkY.cjs} +3 -3
- package/dist/{command-Dh_oQxDu.mjs → command-o-MfrQiP.mjs} +3 -3
- package/dist/{index-zIZBoE62.mjs → index-DN6ihUoI.mjs} +324 -8
- package/dist/{index-IkNv7MfY.cjs → index-aAcmZ774.cjs} +327 -11
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +267 -159
- package/dist/lib.d.mts +267 -159
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-CZEdRTGx.mjs → persistence-DBVrW1P5.mjs} +1 -1
- package/dist/{persistence-BlqXzujW.cjs → persistence-oHFJbsvr.cjs} +1 -1
- package/dist/{registerKillSessionHandler-B0an4vUf.cjs → registerKillSessionHandler-3R7E1V6V.cjs} +39 -4
- package/dist/{registerKillSessionHandler-DYg4cQCz.mjs → registerKillSessionHandler-BVnsXvxn.mjs} +39 -4
- package/dist/{runClaude-DWeTS-VL.mjs → runClaude-0rReIj8o.mjs} +5 -5
- package/dist/{runClaude-C6PA0-0n.cjs → runClaude-C1eZZv8o.cjs} +5 -5
- package/dist/{runCodex-B_TM-cqA.cjs → runCodex-BROvg6-O.cjs} +26 -9
- package/dist/{runCodex-DUXczsJP.mjs → runCodex-CwT9QIML.mjs} +26 -9
- package/dist/{runGemini-CBpN6a9w.mjs → runGemini-BlJNEB-g.mjs} +5 -5
- package/dist/{runGemini-0-mnECiy.cjs → runGemini-C-oJCLfz.cjs} +5 -5
- package/package.json +1 -1
- package/scripts/release-notes-utils.mjs +91 -0
- package/scripts/release-smoke-utils.mjs +11 -0
- package/scripts/release-smoke.mjs +270 -264
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var api = require('./api-
|
|
3
|
+
var index = require('./index-aAcmZ774.cjs');
|
|
4
|
+
var api = require('./api-CleaBHoF.cjs');
|
|
5
5
|
var node_events = require('node:events');
|
|
6
6
|
var node_crypto = require('node:crypto');
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as createSessionMetadata, p as publishSessionRegistration } from './index-
|
|
2
|
-
import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-
|
|
1
|
+
import { a as createSessionMetadata, p as publishSessionRegistration } from './index-DN6ihUoI.mjs';
|
|
2
|
+
import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-ehyDSOc5.mjs';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
4
|
import { randomUUID } from 'node:crypto';
|
|
5
5
|
|
package/dist/{ProviderSelectionHandler-CxLijFCe.mjs → ProviderSelectionHandler-BBhFPe8E.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as logger } from './api-
|
|
2
|
-
import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-
|
|
1
|
+
import { l as logger } from './api-ehyDSOc5.mjs';
|
|
2
|
+
import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-BVnsXvxn.mjs';
|
|
3
3
|
|
|
4
4
|
async function runModeLoop(opts) {
|
|
5
5
|
let currentMode = opts.startingMode;
|
package/dist/{ProviderSelectionHandler-CARO_dnJ.cjs → ProviderSelectionHandler-D-g808TK.cjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var api = require('./api-
|
|
4
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
3
|
+
var api = require('./api-CleaBHoF.cjs');
|
|
4
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-3R7E1V6V.cjs');
|
|
5
5
|
|
|
6
6
|
async function runModeLoop(opts) {
|
|
7
7
|
let currentMode = opts.startingMode;
|
|
@@ -18,7 +18,7 @@ var node_child_process = require('node:child_process');
|
|
|
18
18
|
var expoServerSdk = require('expo-server-sdk');
|
|
19
19
|
|
|
20
20
|
var name = "happy-imou-cloud";
|
|
21
|
-
var version = "2.1.
|
|
21
|
+
var version = "2.1.14";
|
|
22
22
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
23
23
|
var author = "long.zhu";
|
|
24
24
|
var license = "MIT";
|
|
@@ -433,7 +433,7 @@ async function listDaemonLogFiles(limit = 50) {
|
|
|
433
433
|
return { file, path: fullPath, modified: stats.mtime };
|
|
434
434
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
435
435
|
try {
|
|
436
|
-
const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-
|
|
436
|
+
const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-oHFJbsvr.cjs'); });
|
|
437
437
|
const state = await readDaemonState();
|
|
438
438
|
if (!state) {
|
|
439
439
|
return logs;
|
|
@@ -3596,13 +3596,58 @@ class ApiClient {
|
|
|
3596
3596
|
url: opts.url,
|
|
3597
3597
|
body: opts.data,
|
|
3598
3598
|
headers: {
|
|
3599
|
-
"Content-Type": "application/json"
|
|
3599
|
+
"Content-Type": "application/json",
|
|
3600
|
+
...opts.headers ?? {}
|
|
3600
3601
|
},
|
|
3601
3602
|
signRequest: opts.signRequest ?? true
|
|
3602
3603
|
}),
|
|
3603
3604
|
timeout: opts.timeout
|
|
3604
3605
|
});
|
|
3605
3606
|
}
|
|
3607
|
+
async getOrganizationFrontDoor() {
|
|
3608
|
+
const response = await this.request({
|
|
3609
|
+
method: "GET",
|
|
3610
|
+
url: `${configuration.serverUrl}/control/v1/views/organization-front-door`,
|
|
3611
|
+
timeout: 5e3
|
|
3612
|
+
});
|
|
3613
|
+
return response.data.frontDoor;
|
|
3614
|
+
}
|
|
3615
|
+
async listOrganizationAgents(opts = {}) {
|
|
3616
|
+
const response = await this.request({
|
|
3617
|
+
method: "GET",
|
|
3618
|
+
url: `${configuration.serverUrl}/control/v1/agents`,
|
|
3619
|
+
headers: opts.organizationId ? { "x-happy-organization-id": opts.organizationId } : void 0,
|
|
3620
|
+
timeout: 5e3
|
|
3621
|
+
});
|
|
3622
|
+
return response.data.agents;
|
|
3623
|
+
}
|
|
3624
|
+
async createOrganizationDispatchNotice(opts) {
|
|
3625
|
+
const response = await this.request({
|
|
3626
|
+
method: "POST",
|
|
3627
|
+
url: `${configuration.serverUrl}/control/v1/dispatches`,
|
|
3628
|
+
data: {
|
|
3629
|
+
memberAgentId: opts.memberAgentId,
|
|
3630
|
+
task_id: opts.taskId,
|
|
3631
|
+
scope: opts.scope,
|
|
3632
|
+
allowed_paths: opts.allowedPaths,
|
|
3633
|
+
forbidden_paths: opts.forbiddenPaths ?? [],
|
|
3634
|
+
cross_scope_policy: "ask-first",
|
|
3635
|
+
note: opts.note ?? null
|
|
3636
|
+
},
|
|
3637
|
+
headers: { "x-happy-organization-id": opts.organizationId },
|
|
3638
|
+
timeout: 1e4
|
|
3639
|
+
});
|
|
3640
|
+
return response.data.receipt;
|
|
3641
|
+
}
|
|
3642
|
+
async getOrganizationDispatchReceipt(opts) {
|
|
3643
|
+
const response = await this.request({
|
|
3644
|
+
method: "GET",
|
|
3645
|
+
url: `${configuration.serverUrl}/control/v1/views/dispatches/${encodeURIComponent(opts.dispatchId)}`,
|
|
3646
|
+
headers: { "x-happy-organization-id": opts.organizationId },
|
|
3647
|
+
timeout: 5e3
|
|
3648
|
+
});
|
|
3649
|
+
return response.data.receipt;
|
|
3650
|
+
}
|
|
3606
3651
|
async getProtocolV3Descriptor() {
|
|
3607
3652
|
const url = `${configuration.serverUrl}/v3/capabilities`;
|
|
3608
3653
|
const payload = await this.requestProtocolV3Resource({
|
|
@@ -16,7 +16,7 @@ import { spawn } from 'node:child_process';
|
|
|
16
16
|
import { Expo } from 'expo-server-sdk';
|
|
17
17
|
|
|
18
18
|
var name = "happy-imou-cloud";
|
|
19
|
-
var version = "2.1.
|
|
19
|
+
var version = "2.1.14";
|
|
20
20
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
21
21
|
var author = "long.zhu";
|
|
22
22
|
var license = "MIT";
|
|
@@ -431,7 +431,7 @@ async function listDaemonLogFiles(limit = 50) {
|
|
|
431
431
|
return { file, path: fullPath, modified: stats.mtime };
|
|
432
432
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
433
433
|
try {
|
|
434
|
-
const { readDaemonState } = await import('./persistence-
|
|
434
|
+
const { readDaemonState } = await import('./persistence-DBVrW1P5.mjs');
|
|
435
435
|
const state = await readDaemonState();
|
|
436
436
|
if (!state) {
|
|
437
437
|
return logs;
|
|
@@ -3594,13 +3594,58 @@ class ApiClient {
|
|
|
3594
3594
|
url: opts.url,
|
|
3595
3595
|
body: opts.data,
|
|
3596
3596
|
headers: {
|
|
3597
|
-
"Content-Type": "application/json"
|
|
3597
|
+
"Content-Type": "application/json",
|
|
3598
|
+
...opts.headers ?? {}
|
|
3598
3599
|
},
|
|
3599
3600
|
signRequest: opts.signRequest ?? true
|
|
3600
3601
|
}),
|
|
3601
3602
|
timeout: opts.timeout
|
|
3602
3603
|
});
|
|
3603
3604
|
}
|
|
3605
|
+
async getOrganizationFrontDoor() {
|
|
3606
|
+
const response = await this.request({
|
|
3607
|
+
method: "GET",
|
|
3608
|
+
url: `${configuration.serverUrl}/control/v1/views/organization-front-door`,
|
|
3609
|
+
timeout: 5e3
|
|
3610
|
+
});
|
|
3611
|
+
return response.data.frontDoor;
|
|
3612
|
+
}
|
|
3613
|
+
async listOrganizationAgents(opts = {}) {
|
|
3614
|
+
const response = await this.request({
|
|
3615
|
+
method: "GET",
|
|
3616
|
+
url: `${configuration.serverUrl}/control/v1/agents`,
|
|
3617
|
+
headers: opts.organizationId ? { "x-happy-organization-id": opts.organizationId } : void 0,
|
|
3618
|
+
timeout: 5e3
|
|
3619
|
+
});
|
|
3620
|
+
return response.data.agents;
|
|
3621
|
+
}
|
|
3622
|
+
async createOrganizationDispatchNotice(opts) {
|
|
3623
|
+
const response = await this.request({
|
|
3624
|
+
method: "POST",
|
|
3625
|
+
url: `${configuration.serverUrl}/control/v1/dispatches`,
|
|
3626
|
+
data: {
|
|
3627
|
+
memberAgentId: opts.memberAgentId,
|
|
3628
|
+
task_id: opts.taskId,
|
|
3629
|
+
scope: opts.scope,
|
|
3630
|
+
allowed_paths: opts.allowedPaths,
|
|
3631
|
+
forbidden_paths: opts.forbiddenPaths ?? [],
|
|
3632
|
+
cross_scope_policy: "ask-first",
|
|
3633
|
+
note: opts.note ?? null
|
|
3634
|
+
},
|
|
3635
|
+
headers: { "x-happy-organization-id": opts.organizationId },
|
|
3636
|
+
timeout: 1e4
|
|
3637
|
+
});
|
|
3638
|
+
return response.data.receipt;
|
|
3639
|
+
}
|
|
3640
|
+
async getOrganizationDispatchReceipt(opts) {
|
|
3641
|
+
const response = await this.request({
|
|
3642
|
+
method: "GET",
|
|
3643
|
+
url: `${configuration.serverUrl}/control/v1/views/dispatches/${encodeURIComponent(opts.dispatchId)}`,
|
|
3644
|
+
headers: { "x-happy-organization-id": opts.organizationId },
|
|
3645
|
+
timeout: 5e3
|
|
3646
|
+
});
|
|
3647
|
+
return response.data.receipt;
|
|
3648
|
+
}
|
|
3604
3649
|
async getProtocolV3Descriptor() {
|
|
3605
3650
|
const url = `${configuration.serverUrl}/v3/capabilities`;
|
|
3606
3651
|
const payload = await this.requestProtocolV3Resource({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-aAcmZ774.cjs');
|
|
4
4
|
require('chalk');
|
|
5
|
-
require('./api-
|
|
5
|
+
require('./api-CleaBHoF.cjs');
|
|
6
6
|
require('axios');
|
|
7
7
|
require('fs');
|
|
8
8
|
require('node:fs');
|
|
@@ -18,7 +18,7 @@ require('crypto');
|
|
|
18
18
|
require('path');
|
|
19
19
|
require('node:child_process');
|
|
20
20
|
require('expo-server-sdk');
|
|
21
|
-
require('./persistence-
|
|
21
|
+
require('./persistence-oHFJbsvr.cjs');
|
|
22
22
|
require('node:fs/promises');
|
|
23
23
|
require('os');
|
|
24
24
|
require('tmp');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createDefaultRuntimeShell } from './index-
|
|
1
|
+
import { c as createDefaultRuntimeShell } from './index-DN6ihUoI.mjs';
|
|
2
2
|
import 'chalk';
|
|
3
|
-
import './api-
|
|
3
|
+
import './api-ehyDSOc5.mjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'node:fs';
|
|
@@ -16,7 +16,7 @@ import 'crypto';
|
|
|
16
16
|
import 'path';
|
|
17
17
|
import 'node:child_process';
|
|
18
18
|
import 'expo-server-sdk';
|
|
19
|
-
import './persistence-
|
|
19
|
+
import './persistence-DBVrW1P5.mjs';
|
|
20
20
|
import 'node:fs/promises';
|
|
21
21
|
import 'os';
|
|
22
22
|
import 'tmp';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
|
|
2
|
-
import { l as logger, e as encodeBase64, c as configuration, k as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, m as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, n as encodeBase64Url, h as delay, o as buildClientHeaders, p as decodeBase64, q as HAPPY_CLOUD_DAEMON_PORT, r as packageJson, A as ApiClient, t as HeadTailPreviewBuffer, u as getLatestDaemonLog } from './api-
|
|
3
|
-
import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-
|
|
2
|
+
import { l as logger, e as encodeBase64, c as configuration, k as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, m as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, n as encodeBase64Url, h as delay, o as buildClientHeaders, p as decodeBase64, q as HAPPY_CLOUD_DAEMON_PORT, r as packageJson, A as ApiClient, t as HeadTailPreviewBuffer, u as getLatestDaemonLog } from './api-ehyDSOc5.mjs';
|
|
3
|
+
import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-DBVrW1P5.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import fs, { writeFile as writeFile$1, rename, unlink as unlink$1 } from 'fs/promises';
|
|
6
6
|
import os$1, { homedir } from 'os';
|
|
@@ -4715,6 +4715,311 @@ function updateLocalGeminiCredentials(tokens) {
|
|
|
4715
4715
|
}
|
|
4716
4716
|
}
|
|
4717
4717
|
|
|
4718
|
+
const DEFAULT_WAIT_POLL_MS = 2e3;
|
|
4719
|
+
function parseArgs(args) {
|
|
4720
|
+
const positionals = [];
|
|
4721
|
+
const values = {};
|
|
4722
|
+
const flags = /* @__PURE__ */ new Set();
|
|
4723
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
4724
|
+
const token = args[index];
|
|
4725
|
+
if (!token?.startsWith("--")) {
|
|
4726
|
+
positionals.push(token);
|
|
4727
|
+
continue;
|
|
4728
|
+
}
|
|
4729
|
+
const key = token.slice(2);
|
|
4730
|
+
const next = args[index + 1];
|
|
4731
|
+
if (next && !next.startsWith("--")) {
|
|
4732
|
+
values[key] = [...values[key] ?? [], next];
|
|
4733
|
+
index += 1;
|
|
4734
|
+
continue;
|
|
4735
|
+
}
|
|
4736
|
+
flags.add(key);
|
|
4737
|
+
}
|
|
4738
|
+
return {
|
|
4739
|
+
positionals,
|
|
4740
|
+
values,
|
|
4741
|
+
flags
|
|
4742
|
+
};
|
|
4743
|
+
}
|
|
4744
|
+
function readSingleValue(parsed, key) {
|
|
4745
|
+
const entries = parsed.values[key];
|
|
4746
|
+
const value = entries && entries.length > 0 ? entries[entries.length - 1]?.trim() : null;
|
|
4747
|
+
return value ? value : null;
|
|
4748
|
+
}
|
|
4749
|
+
function readPathList(parsed, opts) {
|
|
4750
|
+
const singular = parsed.values[opts.singular] ?? [];
|
|
4751
|
+
const plural = (parsed.values[opts.plural] ?? []).flatMap((value) => value.split(","));
|
|
4752
|
+
return [...singular, ...plural].map((value) => value.trim()).filter((value) => value.length > 0);
|
|
4753
|
+
}
|
|
4754
|
+
function readBooleanFlag(parsed, key) {
|
|
4755
|
+
return parsed.flags.has(key);
|
|
4756
|
+
}
|
|
4757
|
+
function readWaitSeconds(parsed) {
|
|
4758
|
+
const value = readSingleValue(parsed, "wait-seconds");
|
|
4759
|
+
if (!value) {
|
|
4760
|
+
return 0;
|
|
4761
|
+
}
|
|
4762
|
+
const parsedNumber = Number(value);
|
|
4763
|
+
if (!Number.isFinite(parsedNumber) || parsedNumber < 0) {
|
|
4764
|
+
throw new Error(`Invalid --wait-seconds value: ${value}`);
|
|
4765
|
+
}
|
|
4766
|
+
return parsedNumber;
|
|
4767
|
+
}
|
|
4768
|
+
function normalizeRef(value) {
|
|
4769
|
+
const trimmed = value?.trim().toLowerCase();
|
|
4770
|
+
return trimmed ? trimmed : null;
|
|
4771
|
+
}
|
|
4772
|
+
function resolveMemberAgent(agents, opts) {
|
|
4773
|
+
const memberId = normalizeRef(opts.memberId);
|
|
4774
|
+
if (memberId) {
|
|
4775
|
+
const resolved = agents.find((agent) => normalizeRef(agent.id) === memberId);
|
|
4776
|
+
if (!resolved) {
|
|
4777
|
+
throw new Error(`No member found for --member-id ${opts.memberId}`);
|
|
4778
|
+
}
|
|
4779
|
+
if (resolved.isRoot) {
|
|
4780
|
+
throw new Error(`Member ${resolved.id} is the CEO/root agent and cannot receive specialist dispatch notices`);
|
|
4781
|
+
}
|
|
4782
|
+
return resolved;
|
|
4783
|
+
}
|
|
4784
|
+
const memberName = normalizeRef(opts.memberName);
|
|
4785
|
+
if (memberName) {
|
|
4786
|
+
const exactMatches = agents.filter((agent) => !agent.isRoot && normalizeRef(agent.name) === memberName);
|
|
4787
|
+
if (exactMatches.length === 1) {
|
|
4788
|
+
return exactMatches[0];
|
|
4789
|
+
}
|
|
4790
|
+
if (exactMatches.length > 1) {
|
|
4791
|
+
throw new Error(`Multiple members matched --member-name ${opts.memberName}; use --member-id instead`);
|
|
4792
|
+
}
|
|
4793
|
+
throw new Error(`No member found for --member-name ${opts.memberName}`);
|
|
4794
|
+
}
|
|
4795
|
+
const scope = normalizeRef(opts.scope);
|
|
4796
|
+
if (!scope) {
|
|
4797
|
+
throw new Error("Dispatch send requires --scope and either --member-id, --member-name, or a unique scope match");
|
|
4798
|
+
}
|
|
4799
|
+
const candidates = agents.filter(
|
|
4800
|
+
(agent) => !agent.isRoot && (normalizeRef(agent.name) === scope || normalizeRef(agent.role) === scope)
|
|
4801
|
+
);
|
|
4802
|
+
if (candidates.length === 1) {
|
|
4803
|
+
return candidates[0];
|
|
4804
|
+
}
|
|
4805
|
+
if (candidates.length > 1) {
|
|
4806
|
+
throw new Error(`Multiple members matched --scope ${opts.scope}; use --member-id instead`);
|
|
4807
|
+
}
|
|
4808
|
+
throw new Error(`No member matched --scope ${opts.scope}`);
|
|
4809
|
+
}
|
|
4810
|
+
function formatAgentRecord(agent, organizationId) {
|
|
4811
|
+
const lines = [
|
|
4812
|
+
`organization_id=${organizationId}`,
|
|
4813
|
+
`agent_id=${agent.id}`,
|
|
4814
|
+
`session_id=${agent.sessionId}`,
|
|
4815
|
+
`name=${agent.name}`,
|
|
4816
|
+
`role=${agent.role ?? ""}`,
|
|
4817
|
+
`status=${agent.status}`,
|
|
4818
|
+
`is_root=${agent.isRoot ? "yes" : "no"}`,
|
|
4819
|
+
`supervisor_agent_id=${agent.supervisorAgentId ?? ""}`
|
|
4820
|
+
];
|
|
4821
|
+
return lines.join("\n");
|
|
4822
|
+
}
|
|
4823
|
+
function formatDispatchReceipt(receipt) {
|
|
4824
|
+
const lines = [
|
|
4825
|
+
`organization_id=${receipt.organizationId}`,
|
|
4826
|
+
`dispatch_id=${receipt.notice.dispatch_id}`,
|
|
4827
|
+
`task_id=${receipt.notice.task_id}`,
|
|
4828
|
+
`scope=${receipt.notice.scope}`,
|
|
4829
|
+
`member_agent_id=${receipt.member?.agentId ?? receipt.business_ack?.memberAgentId ?? ""}`,
|
|
4830
|
+
`member_label=${receipt.member?.label ?? ""}`,
|
|
4831
|
+
`current_status=${receipt.currentStatus}`,
|
|
4832
|
+
`delivery_status=${receipt.delivery.status}`,
|
|
4833
|
+
`business_ack_status=${receipt.business_ack?.status ?? "pending_ack"}`,
|
|
4834
|
+
`ack_note=${receipt.business_ack?.note ?? ""}`
|
|
4835
|
+
];
|
|
4836
|
+
return lines.join("\n");
|
|
4837
|
+
}
|
|
4838
|
+
async function resolveOrganizationId(api, explicitOrganizationId) {
|
|
4839
|
+
if (explicitOrganizationId) {
|
|
4840
|
+
return {
|
|
4841
|
+
organizationId: explicitOrganizationId,
|
|
4842
|
+
frontDoor: null
|
|
4843
|
+
};
|
|
4844
|
+
}
|
|
4845
|
+
const frontDoor = await api.getOrganizationFrontDoor();
|
|
4846
|
+
return {
|
|
4847
|
+
organizationId: frontDoor.organization.id,
|
|
4848
|
+
frontDoor
|
|
4849
|
+
};
|
|
4850
|
+
}
|
|
4851
|
+
function showHappyOrgHelp(logger) {
|
|
4852
|
+
logger.log(`
|
|
4853
|
+
${chalk.bold("hicloud happy-org")} - Thin CLI sender for Happy Org dispatch/receipt flow
|
|
4854
|
+
|
|
4855
|
+
${chalk.bold("Usage:")}
|
|
4856
|
+
hicloud happy-org agents [--organization-id <id>] [--json]
|
|
4857
|
+
hicloud happy-org dispatch send --task-id <task> --scope <scope> [--member-id <id> | --member-name <name>] --allowed-paths <csv> [--forbidden-paths <csv>] [--organization-id <id>] [--note <text>] [--wait-seconds <n>] [--json]
|
|
4858
|
+
hicloud happy-org dispatch receipt <dispatch-id> [--organization-id <id>] [--json]
|
|
4859
|
+
|
|
4860
|
+
${chalk.bold("Examples:")}
|
|
4861
|
+
hicloud happy-org agents --json
|
|
4862
|
+
hicloud happy-org dispatch send --scope console-agent --task-id CONSOLE-1.1A-P1-001 --allowed-paths happy/packages/happy-console/**
|
|
4863
|
+
hicloud happy-org dispatch receipt dispatch-abc123 --json
|
|
4864
|
+
`);
|
|
4865
|
+
}
|
|
4866
|
+
async function requireApi(deps) {
|
|
4867
|
+
const readCredentialsImpl = deps.readCredentials ?? readCredentials;
|
|
4868
|
+
const credentials = await readCredentialsImpl();
|
|
4869
|
+
if (!credentials) {
|
|
4870
|
+
throw new Error('Not authenticated. Run "hicloud auth login" first.');
|
|
4871
|
+
}
|
|
4872
|
+
const createApiClient = deps.createApiClient ?? (async (nextCredentials) => await ApiClient.create(nextCredentials));
|
|
4873
|
+
return await createApiClient(credentials);
|
|
4874
|
+
}
|
|
4875
|
+
async function handleAgentsCommand(parsed, deps) {
|
|
4876
|
+
const logger = deps.logger ?? console;
|
|
4877
|
+
const api = await requireApi(deps);
|
|
4878
|
+
const { organizationId } = await resolveOrganizationId(api, readSingleValue(parsed, "organization-id"));
|
|
4879
|
+
const agents = await api.listOrganizationAgents({ organizationId });
|
|
4880
|
+
const orderedAgents = [...agents].sort((left, right) => {
|
|
4881
|
+
if (left.isRoot !== right.isRoot) {
|
|
4882
|
+
return left.isRoot ? -1 : 1;
|
|
4883
|
+
}
|
|
4884
|
+
return left.name.localeCompare(right.name);
|
|
4885
|
+
});
|
|
4886
|
+
if (readBooleanFlag(parsed, "json")) {
|
|
4887
|
+
logger.log(JSON.stringify({
|
|
4888
|
+
organizationId,
|
|
4889
|
+
agents: orderedAgents
|
|
4890
|
+
}, null, 2));
|
|
4891
|
+
return;
|
|
4892
|
+
}
|
|
4893
|
+
orderedAgents.forEach((agent, index) => {
|
|
4894
|
+
if (index > 0) {
|
|
4895
|
+
logger.log("");
|
|
4896
|
+
}
|
|
4897
|
+
logger.log(formatAgentRecord(agent, organizationId));
|
|
4898
|
+
});
|
|
4899
|
+
}
|
|
4900
|
+
async function waitForDispatchAck(api, opts) {
|
|
4901
|
+
let receipt = await api.getOrganizationDispatchReceipt({
|
|
4902
|
+
organizationId: opts.organizationId,
|
|
4903
|
+
dispatchId: opts.dispatchId
|
|
4904
|
+
});
|
|
4905
|
+
if (receipt.currentStatus !== "pending_ack" || opts.waitSeconds <= 0) {
|
|
4906
|
+
return receipt;
|
|
4907
|
+
}
|
|
4908
|
+
const deadline = opts.now() + opts.waitSeconds * 1e3;
|
|
4909
|
+
while (opts.now() < deadline) {
|
|
4910
|
+
await opts.sleep(DEFAULT_WAIT_POLL_MS);
|
|
4911
|
+
receipt = await api.getOrganizationDispatchReceipt({
|
|
4912
|
+
organizationId: opts.organizationId,
|
|
4913
|
+
dispatchId: opts.dispatchId
|
|
4914
|
+
});
|
|
4915
|
+
if (receipt.currentStatus !== "pending_ack") {
|
|
4916
|
+
return receipt;
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
return receipt;
|
|
4920
|
+
}
|
|
4921
|
+
async function handleDispatchSendCommand(parsed, deps) {
|
|
4922
|
+
const logger = deps.logger ?? console;
|
|
4923
|
+
const api = await requireApi(deps);
|
|
4924
|
+
const taskId = readSingleValue(parsed, "task-id");
|
|
4925
|
+
const scope = readSingleValue(parsed, "scope");
|
|
4926
|
+
const allowedPaths = readPathList(parsed, { singular: "allowed-path", plural: "allowed-paths" });
|
|
4927
|
+
const forbiddenPaths = readPathList(parsed, { singular: "forbidden-path", plural: "forbidden-paths" });
|
|
4928
|
+
const note = readSingleValue(parsed, "note");
|
|
4929
|
+
const waitSeconds = readWaitSeconds(parsed);
|
|
4930
|
+
if (!taskId) {
|
|
4931
|
+
throw new Error("Dispatch send requires --task-id");
|
|
4932
|
+
}
|
|
4933
|
+
if (!scope) {
|
|
4934
|
+
throw new Error("Dispatch send requires --scope");
|
|
4935
|
+
}
|
|
4936
|
+
if (allowedPaths.length === 0) {
|
|
4937
|
+
throw new Error("Dispatch send requires --allowed-path or --allowed-paths");
|
|
4938
|
+
}
|
|
4939
|
+
const { organizationId } = await resolveOrganizationId(api, readSingleValue(parsed, "organization-id"));
|
|
4940
|
+
const agents = await api.listOrganizationAgents({ organizationId });
|
|
4941
|
+
const member = resolveMemberAgent(agents, {
|
|
4942
|
+
memberId: readSingleValue(parsed, "member-id"),
|
|
4943
|
+
memberName: readSingleValue(parsed, "member-name"),
|
|
4944
|
+
scope
|
|
4945
|
+
});
|
|
4946
|
+
let receipt = await api.createOrganizationDispatchNotice({
|
|
4947
|
+
organizationId,
|
|
4948
|
+
memberAgentId: member.id,
|
|
4949
|
+
taskId,
|
|
4950
|
+
scope,
|
|
4951
|
+
allowedPaths,
|
|
4952
|
+
forbiddenPaths,
|
|
4953
|
+
note
|
|
4954
|
+
});
|
|
4955
|
+
receipt = await waitForDispatchAck(api, {
|
|
4956
|
+
organizationId,
|
|
4957
|
+
dispatchId: receipt.notice.dispatch_id,
|
|
4958
|
+
waitSeconds,
|
|
4959
|
+
sleep: deps.sleep ?? (async (ms) => {
|
|
4960
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
4961
|
+
}),
|
|
4962
|
+
now: deps.now ?? Date.now
|
|
4963
|
+
});
|
|
4964
|
+
if (readBooleanFlag(parsed, "json")) {
|
|
4965
|
+
logger.log(JSON.stringify(receipt, null, 2));
|
|
4966
|
+
return;
|
|
4967
|
+
}
|
|
4968
|
+
logger.log(formatDispatchReceipt(receipt));
|
|
4969
|
+
}
|
|
4970
|
+
async function handleDispatchReceiptCommand(parsed, deps) {
|
|
4971
|
+
const logger = deps.logger ?? console;
|
|
4972
|
+
const dispatchId = parsed.positionals[0]?.trim();
|
|
4973
|
+
if (!dispatchId) {
|
|
4974
|
+
throw new Error("Dispatch receipt requires a dispatch id");
|
|
4975
|
+
}
|
|
4976
|
+
const api = await requireApi(deps);
|
|
4977
|
+
const { organizationId } = await resolveOrganizationId(api, readSingleValue(parsed, "organization-id"));
|
|
4978
|
+
const receipt = await api.getOrganizationDispatchReceipt({
|
|
4979
|
+
organizationId,
|
|
4980
|
+
dispatchId
|
|
4981
|
+
});
|
|
4982
|
+
if (readBooleanFlag(parsed, "json")) {
|
|
4983
|
+
logger.log(JSON.stringify(receipt, null, 2));
|
|
4984
|
+
return;
|
|
4985
|
+
}
|
|
4986
|
+
logger.log(formatDispatchReceipt(receipt));
|
|
4987
|
+
}
|
|
4988
|
+
async function handleDispatchCommand(args, deps) {
|
|
4989
|
+
const [subcommand, ...rest] = args;
|
|
4990
|
+
const parsed = parseArgs(rest);
|
|
4991
|
+
if (!subcommand || subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
|
|
4992
|
+
showHappyOrgHelp(deps.logger ?? console);
|
|
4993
|
+
return;
|
|
4994
|
+
}
|
|
4995
|
+
if (subcommand === "send") {
|
|
4996
|
+
await handleDispatchSendCommand(parsed, deps);
|
|
4997
|
+
return;
|
|
4998
|
+
}
|
|
4999
|
+
if (subcommand === "receipt") {
|
|
5000
|
+
await handleDispatchReceiptCommand(parsed, deps);
|
|
5001
|
+
return;
|
|
5002
|
+
}
|
|
5003
|
+
throw new Error(`Unknown happy-org dispatch subcommand: ${subcommand}`);
|
|
5004
|
+
}
|
|
5005
|
+
async function handleHappyOrgCommand(args, deps = {}) {
|
|
5006
|
+
const [subcommand, ...rest] = args;
|
|
5007
|
+
if (!subcommand || subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
|
|
5008
|
+
showHappyOrgHelp(deps.logger ?? console);
|
|
5009
|
+
return;
|
|
5010
|
+
}
|
|
5011
|
+
const parsed = parseArgs(rest);
|
|
5012
|
+
if (subcommand === "agents") {
|
|
5013
|
+
await handleAgentsCommand(parsed, deps);
|
|
5014
|
+
return;
|
|
5015
|
+
}
|
|
5016
|
+
if (subcommand === "dispatch") {
|
|
5017
|
+
await handleDispatchCommand(rest, deps);
|
|
5018
|
+
return;
|
|
5019
|
+
}
|
|
5020
|
+
throw new Error(`Unknown happy-org subcommand: ${subcommand}`);
|
|
5021
|
+
}
|
|
5022
|
+
|
|
4718
5023
|
function getProjectPath(workingDirectory, claudeConfigDirOverride) {
|
|
4719
5024
|
const projectId = resolve$1(workingDirectory).replace(/[^a-zA-Z0-9-]/g, "-");
|
|
4720
5025
|
const claudeConfigDirRaw = process.env.CLAUDE_CONFIG_DIR ?? "";
|
|
@@ -9992,11 +10297,11 @@ var launch = /*#__PURE__*/Object.freeze({
|
|
|
9992
10297
|
|
|
9993
10298
|
const unifiedProviderExecutors = {
|
|
9994
10299
|
claude: async (opts) => {
|
|
9995
|
-
const { runClaude } = await import('./runClaude-
|
|
10300
|
+
const { runClaude } = await import('./runClaude-0rReIj8o.mjs');
|
|
9996
10301
|
await runClaude(opts.credentials, opts.claudeOptions ?? {});
|
|
9997
10302
|
},
|
|
9998
10303
|
codex: async (opts) => {
|
|
9999
|
-
const { runCodex } = await import('./runCodex-
|
|
10304
|
+
const { runCodex } = await import('./runCodex-CwT9QIML.mjs');
|
|
10000
10305
|
await runCodex({
|
|
10001
10306
|
credentials: opts.credentials,
|
|
10002
10307
|
startedBy: opts.startedBy,
|
|
@@ -10005,7 +10310,7 @@ const unifiedProviderExecutors = {
|
|
|
10005
10310
|
});
|
|
10006
10311
|
},
|
|
10007
10312
|
gemini: async (opts) => {
|
|
10008
|
-
const { runGemini } = await import('./runGemini-
|
|
10313
|
+
const { runGemini } = await import('./runGemini-BlJNEB-g.mjs');
|
|
10009
10314
|
await runGemini({
|
|
10010
10315
|
credentials: opts.credentials,
|
|
10011
10316
|
startedBy: opts.startedBy
|
|
@@ -10088,7 +10393,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
10088
10393
|
return;
|
|
10089
10394
|
} else if (subcommand === "runtime") {
|
|
10090
10395
|
if (args[1] === "providers") {
|
|
10091
|
-
const { renderRuntimeProviders } = await import('./command-
|
|
10396
|
+
const { renderRuntimeProviders } = await import('./command-o-MfrQiP.mjs');
|
|
10092
10397
|
console.log(renderRuntimeProviders());
|
|
10093
10398
|
return;
|
|
10094
10399
|
}
|
|
@@ -10139,6 +10444,17 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
10139
10444
|
process.exit(1);
|
|
10140
10445
|
}
|
|
10141
10446
|
return;
|
|
10447
|
+
} else if (subcommand === "happy-org") {
|
|
10448
|
+
try {
|
|
10449
|
+
await handleHappyOrgCommand(args.slice(1));
|
|
10450
|
+
} catch (error) {
|
|
10451
|
+
console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
|
|
10452
|
+
if (process.env.DEBUG) {
|
|
10453
|
+
console.error(error);
|
|
10454
|
+
}
|
|
10455
|
+
process.exit(1);
|
|
10456
|
+
}
|
|
10457
|
+
return;
|
|
10142
10458
|
} else if (subcommand === "codex") {
|
|
10143
10459
|
try {
|
|
10144
10460
|
let startedBy = void 0;
|
|
@@ -10266,8 +10582,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
10266
10582
|
const projectId = args[3];
|
|
10267
10583
|
try {
|
|
10268
10584
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
10269
|
-
const { readCredentials: readCredentials2 } = await import('./persistence-
|
|
10270
|
-
const { ApiClient: ApiClient2 } = await import('./api-
|
|
10585
|
+
const { readCredentials: readCredentials2 } = await import('./persistence-DBVrW1P5.mjs');
|
|
10586
|
+
const { ApiClient: ApiClient2 } = await import('./api-ehyDSOc5.mjs').then(function (n) { return n.v; });
|
|
10271
10587
|
let userEmail = void 0;
|
|
10272
10588
|
try {
|
|
10273
10589
|
const credentials = await readCredentials2();
|