happy-imou-cloud 2.1.38 → 2.1.40
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-e3WcqGAZ.cjs → BaseReasoningProcessor-C8w4XM-x.cjs} +2 -2
- package/dist/{BaseReasoningProcessor-wTpEeecw.mjs → BaseReasoningProcessor-e-2bxjFB.mjs} +2 -2
- package/dist/{ProviderSelectionHandler-C9BjSS3M.cjs → ProviderSelectionHandler-CCSEAoQk.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-HSpF64um.mjs → ProviderSelectionHandler-DI3-RSW_.mjs} +2 -2
- package/dist/{api-FwOO5yvL.mjs → api-BEKN9moW.mjs} +180 -2
- package/dist/{api-CbDy385l.cjs → api-Ixv6TLYP.cjs} +181 -1
- package/dist/{command-DIwit8GZ.cjs → command-DycfJnzn.cjs} +2 -2
- package/dist/{command-D8dRpb8C.mjs → command-bEdScxsw.mjs} +2 -2
- package/dist/{index-DxyhhizE.mjs → index-CNIT6feF.mjs} +201 -39
- package/dist/{index-B-RcfyFb.cjs → index-Mvx4hucr.cjs} +204 -42
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +77 -4
- package/dist/lib.d.mts +77 -4
- package/dist/lib.mjs +1 -1
- package/dist/{registerKillSessionHandler-BKUa-9cX.mjs → registerKillSessionHandler--KMYjyvz.mjs} +2 -2
- package/dist/{registerKillSessionHandler-CoYWZpXs.cjs → registerKillSessionHandler-CqjocTSr.cjs} +2 -2
- package/dist/{runClaude-CUhIl2_Q.cjs → runClaude-DFdTqEU8.cjs} +59 -5
- package/dist/{runClaude-CeuQr9rp.mjs → runClaude-V1hBSsrL.mjs} +59 -5
- package/dist/{runCodex-B56mNb9m.cjs → runCodex-BMafN7eI.cjs} +34 -8
- package/dist/{runCodex-CKHSREhN.mjs → runCodex-goHWKOd0.mjs} +34 -8
- package/dist/{runGemini-CQIufP_l.mjs → runGemini-BDorYx-I.mjs} +65 -7
- package/dist/{runGemini-DibV-eJ4.cjs → runGemini-CQBCnzbz.cjs} +65 -7
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var persistence = require('./api-
|
|
3
|
+
var index = require('./index-Mvx4hucr.cjs');
|
|
4
|
+
var persistence = require('./api-Ixv6TLYP.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-CNIT6feF.mjs';
|
|
2
|
+
import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-BEKN9moW.mjs';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
4
|
import { randomUUID } from 'node:crypto';
|
|
5
5
|
|
package/dist/{ProviderSelectionHandler-C9BjSS3M.cjs → ProviderSelectionHandler-CCSEAoQk.cjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var persistence = require('./api-
|
|
4
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
3
|
+
var persistence = require('./api-Ixv6TLYP.cjs');
|
|
4
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CqjocTSr.cjs');
|
|
5
5
|
|
|
6
6
|
async function runModeLoop(opts) {
|
|
7
7
|
let currentMode = opts.startingMode;
|
package/dist/{ProviderSelectionHandler-HSpF64um.mjs → ProviderSelectionHandler-DI3-RSW_.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-BEKN9moW.mjs';
|
|
2
|
+
import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler--KMYjyvz.mjs';
|
|
3
3
|
|
|
4
4
|
async function runModeLoop(opts) {
|
|
5
5
|
let currentMode = opts.startingMode;
|
|
@@ -18,7 +18,7 @@ import { spawn } from 'node:child_process';
|
|
|
18
18
|
import { Expo } from 'expo-server-sdk';
|
|
19
19
|
|
|
20
20
|
var name = "happy-imou-cloud";
|
|
21
|
-
var version = "2.1.
|
|
21
|
+
var version = "2.1.40";
|
|
22
22
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
23
23
|
var author = "long.zhu";
|
|
24
24
|
var license = "MIT";
|
|
@@ -1298,6 +1298,26 @@ const HappyOrgSpecialistHomeIdentitySchema = z$1.object({
|
|
|
1298
1298
|
startedBy: z$1.enum(["daemon", "terminal"]).nullish(),
|
|
1299
1299
|
flavor: z$1.string().min(1).nullish()
|
|
1300
1300
|
});
|
|
1301
|
+
const HappyOrgStartupBindingStatusSchema = z$1.enum([
|
|
1302
|
+
"valid",
|
|
1303
|
+
"invalid"
|
|
1304
|
+
]);
|
|
1305
|
+
const HappyOrgStartupBindingFailureReasonSchema = z$1.enum([
|
|
1306
|
+
"startup_home_mismatch",
|
|
1307
|
+
"startup_binding_invalid"
|
|
1308
|
+
]);
|
|
1309
|
+
const HappyOrgStartupBindingSchema = z$1.object({
|
|
1310
|
+
organizationRootPath: z$1.string().min(1).nullish(),
|
|
1311
|
+
source: z$1.enum(["position-home", "legacy-agent-home"]).nullish(),
|
|
1312
|
+
expectedHomePath: z$1.string().min(1),
|
|
1313
|
+
resolvedHomePath: z$1.string().min(1).nullish(),
|
|
1314
|
+
expectedHomeAgentId: z$1.string().min(1).nullish(),
|
|
1315
|
+
resolvedHomeAgentId: z$1.string().min(1).nullish(),
|
|
1316
|
+
expectedHomeRole: z$1.string().min(1).nullish(),
|
|
1317
|
+
resolvedHomeRole: z$1.string().min(1).nullish(),
|
|
1318
|
+
startupBindingStatus: HappyOrgStartupBindingStatusSchema,
|
|
1319
|
+
startupBindingFailureReason: HappyOrgStartupBindingFailureReasonSchema.nullish()
|
|
1320
|
+
});
|
|
1301
1321
|
const HappyOrgMessageMetaSchema = z$1.object({
|
|
1302
1322
|
taskContext: HappyOrgTaskContextSchema.optional(),
|
|
1303
1323
|
control: HappyOrgTaskControlSchema.optional(),
|
|
@@ -1352,6 +1372,7 @@ z$1.object({
|
|
|
1352
1372
|
replyContext: HappyOrgReplyContextSchema.nullish(),
|
|
1353
1373
|
dispatchAcks: z$1.record(z$1.string(), HappyOrgDispatchAckLedgerEntrySchema).optional(),
|
|
1354
1374
|
specialistHome: HappyOrgSpecialistHomeIdentitySchema.nullish(),
|
|
1375
|
+
startupBinding: HappyOrgStartupBindingSchema.nullish(),
|
|
1355
1376
|
repeat: z$1.object({
|
|
1356
1377
|
threshold: z$1.number().int().positive(),
|
|
1357
1378
|
fingerprints: z$1.record(z$1.string(), HappyOrgRepeatEntrySchema)
|
|
@@ -1628,6 +1649,79 @@ const AgentMessageSchema = z$1.object({
|
|
|
1628
1649
|
});
|
|
1629
1650
|
const MessageContentSchema = z$1.union([UserMessageSchema, AgentMessageSchema]);
|
|
1630
1651
|
|
|
1652
|
+
function isNeedsHandoffTask(task) {
|
|
1653
|
+
if (task.status === "waiting_review" || task.status === "waiting_decision" || task.status === "blocked") {
|
|
1654
|
+
return true;
|
|
1655
|
+
}
|
|
1656
|
+
if (task.status !== "active") {
|
|
1657
|
+
return false;
|
|
1658
|
+
}
|
|
1659
|
+
if (task.hasActiveOwner === false) {
|
|
1660
|
+
return true;
|
|
1661
|
+
}
|
|
1662
|
+
if (task.activeOwnerAgentId && task.activeOwnerAgentId !== task.ownerAgentId) {
|
|
1663
|
+
return true;
|
|
1664
|
+
}
|
|
1665
|
+
return false;
|
|
1666
|
+
}
|
|
1667
|
+
function classifyHappyOrgTaskBoardSection(task) {
|
|
1668
|
+
if (task.status === "done") {
|
|
1669
|
+
return "closed";
|
|
1670
|
+
}
|
|
1671
|
+
if (task.status === "waiting_close") {
|
|
1672
|
+
return "awaiting_acceptance";
|
|
1673
|
+
}
|
|
1674
|
+
if (isNeedsHandoffTask(task)) {
|
|
1675
|
+
return "needs_handoff";
|
|
1676
|
+
}
|
|
1677
|
+
return "in_progress";
|
|
1678
|
+
}
|
|
1679
|
+
function buildHappyOrgTaskBoardView(tasks) {
|
|
1680
|
+
const items = [...tasks].filter((task) => task.status !== "terminated").sort((left, right) => right.updatedAt - left.updatedAt || left.taskId.localeCompare(right.taskId)).map((task) => {
|
|
1681
|
+
const sectionKey = classifyHappyOrgTaskBoardSection(task);
|
|
1682
|
+
return {
|
|
1683
|
+
taskId: task.taskId,
|
|
1684
|
+
title: task.title,
|
|
1685
|
+
status: task.status,
|
|
1686
|
+
sectionKey,
|
|
1687
|
+
lane: sectionKey,
|
|
1688
|
+
ownerAgentId: task.ownerAgentId,
|
|
1689
|
+
ownerName: task.ownerName,
|
|
1690
|
+
responsibilityId: task.responsibilityId ?? null,
|
|
1691
|
+
responsibilityLabel: task.responsibilityLabel ?? null,
|
|
1692
|
+
currentProgress: task.summary || null,
|
|
1693
|
+
latestResult: task.reviewSummary || task.resultSummary || null,
|
|
1694
|
+
blockerOrDecision: task.blocker || task.decisionNeeded || task.adviceSummary || null,
|
|
1695
|
+
path: task.path || null,
|
|
1696
|
+
updatedAt: task.updatedAt
|
|
1697
|
+
};
|
|
1698
|
+
});
|
|
1699
|
+
const buckets = {
|
|
1700
|
+
in_progress: [],
|
|
1701
|
+
needs_handoff: [],
|
|
1702
|
+
awaiting_acceptance: [],
|
|
1703
|
+
closed: []
|
|
1704
|
+
};
|
|
1705
|
+
for (const item of items) {
|
|
1706
|
+
buckets[item.sectionKey].push(item);
|
|
1707
|
+
}
|
|
1708
|
+
const sections = [
|
|
1709
|
+
{ key: "in_progress", count: buckets.in_progress.length, items: buckets.in_progress },
|
|
1710
|
+
{ key: "needs_handoff", count: buckets.needs_handoff.length, items: buckets.needs_handoff },
|
|
1711
|
+
{ key: "awaiting_acceptance", count: buckets.awaiting_acceptance.length, items: buckets.awaiting_acceptance },
|
|
1712
|
+
{ key: "closed", count: buckets.closed.length, items: buckets.closed }
|
|
1713
|
+
];
|
|
1714
|
+
return {
|
|
1715
|
+
totalCount: items.length,
|
|
1716
|
+
inProgressCount: sections[0].count,
|
|
1717
|
+
handoffCount: sections[1].count,
|
|
1718
|
+
acceptanceCount: sections[2].count,
|
|
1719
|
+
closedCount: sections[3].count,
|
|
1720
|
+
lastUpdatedAt: items[0]?.updatedAt ?? null,
|
|
1721
|
+
sections
|
|
1722
|
+
};
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1631
1725
|
const HAPPY_ORG_LOCAL_REPO_SCHEMA_VERSION = "1.7.3-local-repo-v1";
|
|
1632
1726
|
const HAPPY_ORG_WRITER_LOCK_SCHEMA_VERSION = "1.7.3-writer-lock-v1";
|
|
1633
1727
|
const WRITER_LOCK_LEASE_DURATION_SECONDS = 900;
|
|
@@ -2175,6 +2269,31 @@ async function readHappyOrgDispatchTruthSnapshot(rootPath) {
|
|
|
2175
2269
|
responsibilities: normalizedResponsibilities
|
|
2176
2270
|
};
|
|
2177
2271
|
}
|
|
2272
|
+
async function readHappyOrgRepoTaskBoard(rootPath) {
|
|
2273
|
+
const [taskIds, positions, responsibilities] = await Promise.all([
|
|
2274
|
+
listTaskIds(rootPath),
|
|
2275
|
+
listPositionEnvelopes(rootPath),
|
|
2276
|
+
readResponsibilities(rootPath)
|
|
2277
|
+
]);
|
|
2278
|
+
const responsibilityLabelById = /* @__PURE__ */ new Map();
|
|
2279
|
+
for (const responsibility of responsibilities?.value ?? []) {
|
|
2280
|
+
responsibilityLabelById.set(responsibility.responsibilityId, responsibility.title);
|
|
2281
|
+
}
|
|
2282
|
+
for (const position of positions) {
|
|
2283
|
+
const fallbackResponsibilityId = position.value.responsibilityIds[0] ?? buildResponsibilityId(position.value.slug);
|
|
2284
|
+
if (!responsibilityLabelById.has(fallbackResponsibilityId)) {
|
|
2285
|
+
responsibilityLabelById.set(fallbackResponsibilityId, position.value.label || position.value.agentName || position.value.slug);
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
const tasks = await Promise.all(taskIds.map(async (taskId) => {
|
|
2289
|
+
const bundle = await loadTaskEnvelope(rootPath, taskId);
|
|
2290
|
+
return bundle ? mergeTaskEnvelope(bundle) : null;
|
|
2291
|
+
}));
|
|
2292
|
+
return buildHappyOrgTaskBoardView(tasks.filter((task) => task !== null).map((task) => ({
|
|
2293
|
+
...task,
|
|
2294
|
+
responsibilityLabel: task.responsibilityLabel ?? (task.responsibilityId ? responsibilityLabelById.get(task.responsibilityId) ?? null : null)
|
|
2295
|
+
})));
|
|
2296
|
+
}
|
|
2178
2297
|
function mergeTaskEnvelope(taskBundle) {
|
|
2179
2298
|
const { task, workflow, result } = taskBundle;
|
|
2180
2299
|
return {
|
|
@@ -3884,6 +4003,59 @@ async function ensureSigningCredentials(credentials, opts = {}) {
|
|
|
3884
4003
|
}
|
|
3885
4004
|
}
|
|
3886
4005
|
|
|
4006
|
+
class AssistantMessageStream {
|
|
4007
|
+
constructor(createId = randomUUID) {
|
|
4008
|
+
this.createId = createId;
|
|
4009
|
+
}
|
|
4010
|
+
activeStream = null;
|
|
4011
|
+
delta() {
|
|
4012
|
+
return this.metadata("delta", "append");
|
|
4013
|
+
}
|
|
4014
|
+
commit() {
|
|
4015
|
+
const metadata = this.metadata("commit", "replace");
|
|
4016
|
+
this.reset();
|
|
4017
|
+
return metadata;
|
|
4018
|
+
}
|
|
4019
|
+
abort() {
|
|
4020
|
+
const metadata = this.metadata("abort", "replace");
|
|
4021
|
+
this.reset();
|
|
4022
|
+
return metadata;
|
|
4023
|
+
}
|
|
4024
|
+
hasActive() {
|
|
4025
|
+
return this.activeStream !== null;
|
|
4026
|
+
}
|
|
4027
|
+
reset() {
|
|
4028
|
+
this.activeStream = null;
|
|
4029
|
+
}
|
|
4030
|
+
metadata(phase, mode) {
|
|
4031
|
+
const activeStream = this.ensureActiveStream();
|
|
4032
|
+
return {
|
|
4033
|
+
streamId: activeStream.streamId,
|
|
4034
|
+
messageId: activeStream.messageId,
|
|
4035
|
+
phase,
|
|
4036
|
+
mode
|
|
4037
|
+
};
|
|
4038
|
+
}
|
|
4039
|
+
ensureActiveStream() {
|
|
4040
|
+
if (this.activeStream) {
|
|
4041
|
+
return this.activeStream;
|
|
4042
|
+
}
|
|
4043
|
+
const id = this.createId();
|
|
4044
|
+
this.activeStream = {
|
|
4045
|
+
streamId: `assistant-${id}`,
|
|
4046
|
+
messageId: id
|
|
4047
|
+
};
|
|
4048
|
+
return this.activeStream;
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
function isTransientMessageStreamDelta(body) {
|
|
4052
|
+
if (!body || typeof body !== "object") {
|
|
4053
|
+
return false;
|
|
4054
|
+
}
|
|
4055
|
+
const record = body;
|
|
4056
|
+
return record.type === "message" && record.phase === "delta";
|
|
4057
|
+
}
|
|
4058
|
+
|
|
3887
4059
|
const MAX_PENDING_RELIABLE_SESSION_MESSAGES = 200;
|
|
3888
4060
|
const MAX_PENDING_RELIABLE_SESSION_MESSAGE_BYTES = 512 * 1024;
|
|
3889
4061
|
const PROTOCOL_V3_INITIAL_SNAPSHOT_LIMIT = 150;
|
|
@@ -5336,6 +5508,9 @@ class ApiSessionClient extends EventEmitter {
|
|
|
5336
5508
|
});
|
|
5337
5509
|
}
|
|
5338
5510
|
shouldBufferReliableCodexMessage(body) {
|
|
5511
|
+
if (isTransientMessageStreamDelta(body)) {
|
|
5512
|
+
return false;
|
|
5513
|
+
}
|
|
5339
5514
|
switch (body?.type) {
|
|
5340
5515
|
case "message":
|
|
5341
5516
|
case "tool-call":
|
|
@@ -5352,6 +5527,9 @@ class ApiSessionClient extends EventEmitter {
|
|
|
5352
5527
|
}
|
|
5353
5528
|
}
|
|
5354
5529
|
shouldBufferReliableAcpMessage(body) {
|
|
5530
|
+
if (isTransientMessageStreamDelta(body)) {
|
|
5531
|
+
return false;
|
|
5532
|
+
}
|
|
5355
5533
|
switch (body?.type) {
|
|
5356
5534
|
case "message":
|
|
5357
5535
|
case "tool-call":
|
|
@@ -6674,4 +6852,4 @@ var api = /*#__PURE__*/Object.freeze({
|
|
|
6674
6852
|
ApiClient: ApiClient
|
|
6675
6853
|
});
|
|
6676
6854
|
|
|
6677
|
-
export { ApiClient as A,
|
|
6855
|
+
export { ApiClient as A, HAPPY_CLOUD_DAEMON_PORT as B, clearDaemonState as C, packageJson as D, acquireDaemonLock as E, writeDaemonState as F, releaseDaemonLock as G, HeadTailPreviewBuffer as H, validateProfileForAgent as I, getProfileEnvironmentVariables as J, clearCredentials as K, clearMachineId as L, readHappyOrgDispatchTruthSnapshot as M, processHappyOrgRepoRequests as N, readHappyOrgRepoTaskBoard as O, HappyOrgTurnReportSchema as P, recordHappyOrgTurnReport as Q, MessageContentSchema as R, buildSocketAuth as S, encrypt as T, getLatestDaemonLog as U, persistence as V, api as W, ApiSessionClient as a, connectionState as b, configuration as c, AssistantMessageStream as d, HAPPY_ORG_REPLY_ACK_VERSION as e, HAPPY_ORG_TURN_REPORT_TAG as f, HAPPY_ORG_SUMMARY_MAX_LENGTH as g, HAPPY_ORG_REPEAT_THRESHOLD as h, isAuthenticationRequiredError as i, backoff as j, delay as k, logger as l, AsyncLock as m, encodeBase64 as n, readCredentials as o, preserveSessionRuntimeMetadata as p, ensureSigningCredentials as q, readSettings as r, startOfflineReconnection as s, encodeBase64Url as t, updateSettings as u, buildClientHeaders as v, decodeBase64 as w, writeCredentialsLegacy as x, writeCredentialsDataKey as y, readDaemonState as z };
|
|
@@ -38,7 +38,7 @@ function _interopNamespaceDefault(e) {
|
|
|
38
38
|
var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
|
|
39
39
|
|
|
40
40
|
var name = "happy-imou-cloud";
|
|
41
|
-
var version = "2.1.
|
|
41
|
+
var version = "2.1.40";
|
|
42
42
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
43
43
|
var author = "long.zhu";
|
|
44
44
|
var license = "MIT";
|
|
@@ -1318,6 +1318,26 @@ const HappyOrgSpecialistHomeIdentitySchema = z.z.object({
|
|
|
1318
1318
|
startedBy: z.z.enum(["daemon", "terminal"]).nullish(),
|
|
1319
1319
|
flavor: z.z.string().min(1).nullish()
|
|
1320
1320
|
});
|
|
1321
|
+
const HappyOrgStartupBindingStatusSchema = z.z.enum([
|
|
1322
|
+
"valid",
|
|
1323
|
+
"invalid"
|
|
1324
|
+
]);
|
|
1325
|
+
const HappyOrgStartupBindingFailureReasonSchema = z.z.enum([
|
|
1326
|
+
"startup_home_mismatch",
|
|
1327
|
+
"startup_binding_invalid"
|
|
1328
|
+
]);
|
|
1329
|
+
const HappyOrgStartupBindingSchema = z.z.object({
|
|
1330
|
+
organizationRootPath: z.z.string().min(1).nullish(),
|
|
1331
|
+
source: z.z.enum(["position-home", "legacy-agent-home"]).nullish(),
|
|
1332
|
+
expectedHomePath: z.z.string().min(1),
|
|
1333
|
+
resolvedHomePath: z.z.string().min(1).nullish(),
|
|
1334
|
+
expectedHomeAgentId: z.z.string().min(1).nullish(),
|
|
1335
|
+
resolvedHomeAgentId: z.z.string().min(1).nullish(),
|
|
1336
|
+
expectedHomeRole: z.z.string().min(1).nullish(),
|
|
1337
|
+
resolvedHomeRole: z.z.string().min(1).nullish(),
|
|
1338
|
+
startupBindingStatus: HappyOrgStartupBindingStatusSchema,
|
|
1339
|
+
startupBindingFailureReason: HappyOrgStartupBindingFailureReasonSchema.nullish()
|
|
1340
|
+
});
|
|
1321
1341
|
const HappyOrgMessageMetaSchema = z.z.object({
|
|
1322
1342
|
taskContext: HappyOrgTaskContextSchema.optional(),
|
|
1323
1343
|
control: HappyOrgTaskControlSchema.optional(),
|
|
@@ -1372,6 +1392,7 @@ z.z.object({
|
|
|
1372
1392
|
replyContext: HappyOrgReplyContextSchema.nullish(),
|
|
1373
1393
|
dispatchAcks: z.z.record(z.z.string(), HappyOrgDispatchAckLedgerEntrySchema).optional(),
|
|
1374
1394
|
specialistHome: HappyOrgSpecialistHomeIdentitySchema.nullish(),
|
|
1395
|
+
startupBinding: HappyOrgStartupBindingSchema.nullish(),
|
|
1375
1396
|
repeat: z.z.object({
|
|
1376
1397
|
threshold: z.z.number().int().positive(),
|
|
1377
1398
|
fingerprints: z.z.record(z.z.string(), HappyOrgRepeatEntrySchema)
|
|
@@ -1648,6 +1669,79 @@ const AgentMessageSchema = z.z.object({
|
|
|
1648
1669
|
});
|
|
1649
1670
|
const MessageContentSchema = z.z.union([UserMessageSchema, AgentMessageSchema]);
|
|
1650
1671
|
|
|
1672
|
+
function isNeedsHandoffTask(task) {
|
|
1673
|
+
if (task.status === "waiting_review" || task.status === "waiting_decision" || task.status === "blocked") {
|
|
1674
|
+
return true;
|
|
1675
|
+
}
|
|
1676
|
+
if (task.status !== "active") {
|
|
1677
|
+
return false;
|
|
1678
|
+
}
|
|
1679
|
+
if (task.hasActiveOwner === false) {
|
|
1680
|
+
return true;
|
|
1681
|
+
}
|
|
1682
|
+
if (task.activeOwnerAgentId && task.activeOwnerAgentId !== task.ownerAgentId) {
|
|
1683
|
+
return true;
|
|
1684
|
+
}
|
|
1685
|
+
return false;
|
|
1686
|
+
}
|
|
1687
|
+
function classifyHappyOrgTaskBoardSection(task) {
|
|
1688
|
+
if (task.status === "done") {
|
|
1689
|
+
return "closed";
|
|
1690
|
+
}
|
|
1691
|
+
if (task.status === "waiting_close") {
|
|
1692
|
+
return "awaiting_acceptance";
|
|
1693
|
+
}
|
|
1694
|
+
if (isNeedsHandoffTask(task)) {
|
|
1695
|
+
return "needs_handoff";
|
|
1696
|
+
}
|
|
1697
|
+
return "in_progress";
|
|
1698
|
+
}
|
|
1699
|
+
function buildHappyOrgTaskBoardView(tasks) {
|
|
1700
|
+
const items = [...tasks].filter((task) => task.status !== "terminated").sort((left, right) => right.updatedAt - left.updatedAt || left.taskId.localeCompare(right.taskId)).map((task) => {
|
|
1701
|
+
const sectionKey = classifyHappyOrgTaskBoardSection(task);
|
|
1702
|
+
return {
|
|
1703
|
+
taskId: task.taskId,
|
|
1704
|
+
title: task.title,
|
|
1705
|
+
status: task.status,
|
|
1706
|
+
sectionKey,
|
|
1707
|
+
lane: sectionKey,
|
|
1708
|
+
ownerAgentId: task.ownerAgentId,
|
|
1709
|
+
ownerName: task.ownerName,
|
|
1710
|
+
responsibilityId: task.responsibilityId ?? null,
|
|
1711
|
+
responsibilityLabel: task.responsibilityLabel ?? null,
|
|
1712
|
+
currentProgress: task.summary || null,
|
|
1713
|
+
latestResult: task.reviewSummary || task.resultSummary || null,
|
|
1714
|
+
blockerOrDecision: task.blocker || task.decisionNeeded || task.adviceSummary || null,
|
|
1715
|
+
path: task.path || null,
|
|
1716
|
+
updatedAt: task.updatedAt
|
|
1717
|
+
};
|
|
1718
|
+
});
|
|
1719
|
+
const buckets = {
|
|
1720
|
+
in_progress: [],
|
|
1721
|
+
needs_handoff: [],
|
|
1722
|
+
awaiting_acceptance: [],
|
|
1723
|
+
closed: []
|
|
1724
|
+
};
|
|
1725
|
+
for (const item of items) {
|
|
1726
|
+
buckets[item.sectionKey].push(item);
|
|
1727
|
+
}
|
|
1728
|
+
const sections = [
|
|
1729
|
+
{ key: "in_progress", count: buckets.in_progress.length, items: buckets.in_progress },
|
|
1730
|
+
{ key: "needs_handoff", count: buckets.needs_handoff.length, items: buckets.needs_handoff },
|
|
1731
|
+
{ key: "awaiting_acceptance", count: buckets.awaiting_acceptance.length, items: buckets.awaiting_acceptance },
|
|
1732
|
+
{ key: "closed", count: buckets.closed.length, items: buckets.closed }
|
|
1733
|
+
];
|
|
1734
|
+
return {
|
|
1735
|
+
totalCount: items.length,
|
|
1736
|
+
inProgressCount: sections[0].count,
|
|
1737
|
+
handoffCount: sections[1].count,
|
|
1738
|
+
acceptanceCount: sections[2].count,
|
|
1739
|
+
closedCount: sections[3].count,
|
|
1740
|
+
lastUpdatedAt: items[0]?.updatedAt ?? null,
|
|
1741
|
+
sections
|
|
1742
|
+
};
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1651
1745
|
const HAPPY_ORG_LOCAL_REPO_SCHEMA_VERSION = "1.7.3-local-repo-v1";
|
|
1652
1746
|
const HAPPY_ORG_WRITER_LOCK_SCHEMA_VERSION = "1.7.3-writer-lock-v1";
|
|
1653
1747
|
const WRITER_LOCK_LEASE_DURATION_SECONDS = 900;
|
|
@@ -2195,6 +2289,31 @@ async function readHappyOrgDispatchTruthSnapshot(rootPath) {
|
|
|
2195
2289
|
responsibilities: normalizedResponsibilities
|
|
2196
2290
|
};
|
|
2197
2291
|
}
|
|
2292
|
+
async function readHappyOrgRepoTaskBoard(rootPath) {
|
|
2293
|
+
const [taskIds, positions, responsibilities] = await Promise.all([
|
|
2294
|
+
listTaskIds(rootPath),
|
|
2295
|
+
listPositionEnvelopes(rootPath),
|
|
2296
|
+
readResponsibilities(rootPath)
|
|
2297
|
+
]);
|
|
2298
|
+
const responsibilityLabelById = /* @__PURE__ */ new Map();
|
|
2299
|
+
for (const responsibility of responsibilities?.value ?? []) {
|
|
2300
|
+
responsibilityLabelById.set(responsibility.responsibilityId, responsibility.title);
|
|
2301
|
+
}
|
|
2302
|
+
for (const position of positions) {
|
|
2303
|
+
const fallbackResponsibilityId = position.value.responsibilityIds[0] ?? buildResponsibilityId(position.value.slug);
|
|
2304
|
+
if (!responsibilityLabelById.has(fallbackResponsibilityId)) {
|
|
2305
|
+
responsibilityLabelById.set(fallbackResponsibilityId, position.value.label || position.value.agentName || position.value.slug);
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
const tasks = await Promise.all(taskIds.map(async (taskId) => {
|
|
2309
|
+
const bundle = await loadTaskEnvelope(rootPath, taskId);
|
|
2310
|
+
return bundle ? mergeTaskEnvelope(bundle) : null;
|
|
2311
|
+
}));
|
|
2312
|
+
return buildHappyOrgTaskBoardView(tasks.filter((task) => task !== null).map((task) => ({
|
|
2313
|
+
...task,
|
|
2314
|
+
responsibilityLabel: task.responsibilityLabel ?? (task.responsibilityId ? responsibilityLabelById.get(task.responsibilityId) ?? null : null)
|
|
2315
|
+
})));
|
|
2316
|
+
}
|
|
2198
2317
|
function mergeTaskEnvelope(taskBundle) {
|
|
2199
2318
|
const { task, workflow, result } = taskBundle;
|
|
2200
2319
|
return {
|
|
@@ -3904,6 +4023,59 @@ async function ensureSigningCredentials(credentials, opts = {}) {
|
|
|
3904
4023
|
}
|
|
3905
4024
|
}
|
|
3906
4025
|
|
|
4026
|
+
class AssistantMessageStream {
|
|
4027
|
+
constructor(createId = node_crypto.randomUUID) {
|
|
4028
|
+
this.createId = createId;
|
|
4029
|
+
}
|
|
4030
|
+
activeStream = null;
|
|
4031
|
+
delta() {
|
|
4032
|
+
return this.metadata("delta", "append");
|
|
4033
|
+
}
|
|
4034
|
+
commit() {
|
|
4035
|
+
const metadata = this.metadata("commit", "replace");
|
|
4036
|
+
this.reset();
|
|
4037
|
+
return metadata;
|
|
4038
|
+
}
|
|
4039
|
+
abort() {
|
|
4040
|
+
const metadata = this.metadata("abort", "replace");
|
|
4041
|
+
this.reset();
|
|
4042
|
+
return metadata;
|
|
4043
|
+
}
|
|
4044
|
+
hasActive() {
|
|
4045
|
+
return this.activeStream !== null;
|
|
4046
|
+
}
|
|
4047
|
+
reset() {
|
|
4048
|
+
this.activeStream = null;
|
|
4049
|
+
}
|
|
4050
|
+
metadata(phase, mode) {
|
|
4051
|
+
const activeStream = this.ensureActiveStream();
|
|
4052
|
+
return {
|
|
4053
|
+
streamId: activeStream.streamId,
|
|
4054
|
+
messageId: activeStream.messageId,
|
|
4055
|
+
phase,
|
|
4056
|
+
mode
|
|
4057
|
+
};
|
|
4058
|
+
}
|
|
4059
|
+
ensureActiveStream() {
|
|
4060
|
+
if (this.activeStream) {
|
|
4061
|
+
return this.activeStream;
|
|
4062
|
+
}
|
|
4063
|
+
const id = this.createId();
|
|
4064
|
+
this.activeStream = {
|
|
4065
|
+
streamId: `assistant-${id}`,
|
|
4066
|
+
messageId: id
|
|
4067
|
+
};
|
|
4068
|
+
return this.activeStream;
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
function isTransientMessageStreamDelta(body) {
|
|
4072
|
+
if (!body || typeof body !== "object") {
|
|
4073
|
+
return false;
|
|
4074
|
+
}
|
|
4075
|
+
const record = body;
|
|
4076
|
+
return record.type === "message" && record.phase === "delta";
|
|
4077
|
+
}
|
|
4078
|
+
|
|
3907
4079
|
const MAX_PENDING_RELIABLE_SESSION_MESSAGES = 200;
|
|
3908
4080
|
const MAX_PENDING_RELIABLE_SESSION_MESSAGE_BYTES = 512 * 1024;
|
|
3909
4081
|
const PROTOCOL_V3_INITIAL_SNAPSHOT_LIMIT = 150;
|
|
@@ -5356,6 +5528,9 @@ class ApiSessionClient extends node_events.EventEmitter {
|
|
|
5356
5528
|
});
|
|
5357
5529
|
}
|
|
5358
5530
|
shouldBufferReliableCodexMessage(body) {
|
|
5531
|
+
if (isTransientMessageStreamDelta(body)) {
|
|
5532
|
+
return false;
|
|
5533
|
+
}
|
|
5359
5534
|
switch (body?.type) {
|
|
5360
5535
|
case "message":
|
|
5361
5536
|
case "tool-call":
|
|
@@ -5372,6 +5547,9 @@ class ApiSessionClient extends node_events.EventEmitter {
|
|
|
5372
5547
|
}
|
|
5373
5548
|
}
|
|
5374
5549
|
shouldBufferReliableAcpMessage(body) {
|
|
5550
|
+
if (isTransientMessageStreamDelta(body)) {
|
|
5551
|
+
return false;
|
|
5552
|
+
}
|
|
5375
5553
|
switch (body?.type) {
|
|
5376
5554
|
case "message":
|
|
5377
5555
|
case "tool-call":
|
|
@@ -6696,6 +6874,7 @@ var api = /*#__PURE__*/Object.freeze({
|
|
|
6696
6874
|
|
|
6697
6875
|
exports.ApiClient = ApiClient;
|
|
6698
6876
|
exports.ApiSessionClient = ApiSessionClient;
|
|
6877
|
+
exports.AssistantMessageStream = AssistantMessageStream;
|
|
6699
6878
|
exports.AsyncLock = AsyncLock;
|
|
6700
6879
|
exports.HAPPY_CLOUD_DAEMON_PORT = HAPPY_CLOUD_DAEMON_PORT;
|
|
6701
6880
|
exports.HAPPY_ORG_REPEAT_THRESHOLD = HAPPY_ORG_REPEAT_THRESHOLD;
|
|
@@ -6732,6 +6911,7 @@ exports.processHappyOrgRepoRequests = processHappyOrgRepoRequests;
|
|
|
6732
6911
|
exports.readCredentials = readCredentials;
|
|
6733
6912
|
exports.readDaemonState = readDaemonState;
|
|
6734
6913
|
exports.readHappyOrgDispatchTruthSnapshot = readHappyOrgDispatchTruthSnapshot;
|
|
6914
|
+
exports.readHappyOrgRepoTaskBoard = readHappyOrgRepoTaskBoard;
|
|
6735
6915
|
exports.readSettings = readSettings;
|
|
6736
6916
|
exports.recordHappyOrgTurnReport = recordHappyOrgTurnReport;
|
|
6737
6917
|
exports.releaseDaemonLock = releaseDaemonLock;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createDefaultRuntimeShell } from './index-
|
|
1
|
+
import { c as createDefaultRuntimeShell } from './index-CNIT6feF.mjs';
|
|
2
2
|
import 'chalk';
|
|
3
|
-
import './api-
|
|
3
|
+
import './api-BEKN9moW.mjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'node:fs';
|