nolo-cli 0.263.0-alpha.1 → 0.264.0-alpha.2
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/{_executeModel-GZEGNZDC.js → _executeModel-YQNZNR2Y.js} +15 -15
- package/{agentDeleteCommand-PYQFS2IO.js → agentDeleteCommand-S5FVPYKT.js} +13 -13
- package/{agentEmailCommands-MSPYHNQA.js → agentEmailCommands-ZEFMGVKM.js} +14 -14
- package/{agentMachineCommands-HHH7DR26.js → agentMachineCommands-COJD2KPZ.js} +2 -2
- package/{agentRecordCommands-ANOOR7DX.js → agentRecordCommands-JZ35AC5A.js} +14 -14
- package/{agentRun-P6GEVWAT.js → agentRun-UIO43TUG.js} +14 -14
- package/{agentRunCommand-SF4QKUF2.js → agentRunCommand-ATLKKD6O.js} +15 -15
- package/{agentSlice-NWSWCYRW.js → agentSlice-HHNKNNYM.js} +1 -1
- package/{chunk-6S4VPBSW.js → chunk-4RUQ2PFX.js} +4 -4
- package/{chunk-L4KZCAIJ.js → chunk-4UNN45DS.js} +5 -5
- package/{chunk-KUZSTAE3.js → chunk-7422ZLGL.js} +7 -7
- package/{chunk-KTK64ZZN.js → chunk-7E6YXSFZ.js} +2 -2
- package/{chunk-JUMQJSQF.js → chunk-DALXH7BG.js} +211 -177
- package/{chunk-OV47NSYQ.js → chunk-DBCWXGOC.js} +8 -8
- package/{chunk-DPFHC2DK.js → chunk-DBEOW57U.js} +2 -2
- package/{chunk-YSYTCIFN.js → chunk-EBH4RFJ6.js} +216 -33
- package/{chunk-5MGXBQ3H.js → chunk-EODBQPRM.js} +2 -2
- package/{chunk-BUO76CEE.js → chunk-HXEO5DNV.js} +2 -2
- package/chunk-JDMWYVUF.js +449 -0
- package/{chunk-WWE3TYSA.js → chunk-LTQ6ECCF.js} +3 -3
- package/{chunk-ZMOKHBV5.js → chunk-LYPJYBE5.js} +2 -2
- package/{chunk-OLJSB44A.js → chunk-MALPQFGT.js} +6 -6
- package/{chunk-QAUBNGF2.js → chunk-OKPOQGQJ.js} +3 -3
- package/{chunk-6KA4XDEI.js → chunk-PDSXYHNI.js} +2 -2
- package/{chunk-QHSF7SPP.js → chunk-QAU6KM2U.js} +1 -1
- package/{chunk-ZZOXGB2Z.js → chunk-QAW6BEWQ.js} +6 -6
- package/{chunk-Z7TB2J74.js → chunk-T3MWVUBE.js} +1 -1
- package/{chunk-JTRU7WEG.js → chunk-TGVVE5BA.js} +177 -44
- package/{chunk-PJVJIDTH.js → chunk-TKLBBR7P.js} +3 -3
- package/{chunk-CQNGHKSG.js → chunk-U7OULUMF.js} +3 -3
- package/{chunk-WJ5IXN23.js → chunk-ZCMAKAZM.js} +1 -1
- package/{chunk-XCPC4RXE.js → chunk-ZSZBHRLP.js} +4 -4
- package/{cliExecutor-Z62UBJ5S.js → cliExecutor-N3445G2Z.js} +1 -1
- package/{commandRegistry-ZEZY7MPW.js → commandRegistry-ENNFT77C.js} +18 -18
- package/{contentThunks-N3DDKRNJ.js → contentThunks-ERA42OXW.js} +4 -4
- package/{createAgentAutomationAction-W3B6KOIW.js → createAgentAutomationAction-DMD2VDPI.js} +4 -4
- package/{createDialogAction-V6WA7USR.js → createDialogAction-3SPOJQAK.js} +5 -5
- package/{createPageAction-P2HDHBCU.js → createPageAction-AVXUMZVT.js} +5 -5
- package/{deleteDbKey-TDXLWHVF.js → deleteDbKey-KV6MYBAI.js} +5 -5
- package/{dialogSlice-TEV6XXOO.js → dialogSlice-Q7H2YVNO.js} +2 -2
- package/{docStore-OVBEONC7.js → docStore-GWPFDV6Y.js} +1 -1
- package/{handleSendMessageAction-5GZ44SKK.js → handleSendMessageAction-FHGUFT2X.js} +9 -9
- package/{hostCredentialCreate-WOLFFVCM.js → hostCredentialCreate-2VEYBXJV.js} +14 -14
- package/index.js +3 -3
- package/{localAutomationCommands-L333FJPR.js → localAutomationCommands-XSK7SM7I.js} +1 -1
- package/{localAutomationRuntime-CIHGJBSC.js → localAutomationRuntime-5WBO7HGQ.js} +1 -1
- package/{localRuntimeAdapter-6WNR7IYN.js → localRuntimeAdapter-Y6H6XRIH.js} +13 -13
- package/{machineCommands-CP7NCD6O.js → machineCommands-RVB5OG2X.js} +16 -16
- package/{machineWsRunDispatch-YIAY2LPK.js → machineWsRunDispatch-Y5SJGCEE.js} +14 -14
- package/{memberThunks-TD76IFGA.js → memberThunks-NEZRAW5K.js} +18 -175
- package/package.json +1 -1
- package/{projectArchive-KJRBIY3O.js → projectArchive-WE3VVPZ2.js} +5 -5
- package/{readlineWorkspace-2PLTEZDM.js → readlineWorkspace-ZH5FGDMI.js} +18 -18
- package/{runAgentClientLoop-IBWSCK2D.js → runAgentClientLoop-2SFASHDS.js} +13 -13
- package/{streamAgentChatTurn-JAAROGLD.js → streamAgentChatTurn-KOUWITHH.js} +15 -15
- package/{tools-TCOYT5DJ.js → tools-WN4AVSNS.js} +10 -10
- package/{updateDialogTitleAction-O3TRFRIH.js → updateDialogTitleAction-XOSLNRT3.js} +4 -4
- package/chunk-EHFDVQF5.js +0 -247
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeSpaceId
|
|
3
|
+
} from "./chunk-UAD2WT54.js";
|
|
4
|
+
import {
|
|
5
|
+
toTimestampMs,
|
|
6
|
+
upsertSSREntity
|
|
7
|
+
} from "./chunk-6NYQHXMV.js";
|
|
8
|
+
import {
|
|
9
|
+
isDeviceLocalSpaceBody
|
|
10
|
+
} from "./chunk-MTNQNLSE.js";
|
|
11
|
+
import {
|
|
12
|
+
getRuntimeServerSnapshot,
|
|
13
|
+
require_react,
|
|
14
|
+
selectIdentityToken
|
|
15
|
+
} from "./chunk-HI5RS2O4.js";
|
|
16
|
+
import {
|
|
17
|
+
getAllServers,
|
|
18
|
+
googleSessionRequestToken,
|
|
19
|
+
isGoogleAuthoritySession,
|
|
20
|
+
scopeGoogleSessionServers
|
|
21
|
+
} from "./chunk-K7HLFORE.js";
|
|
22
|
+
import {
|
|
23
|
+
__toESM
|
|
24
|
+
} from "./chunk-U67V476Y.js";
|
|
25
|
+
|
|
26
|
+
// packages/create/space/spaceCurrentStore.ts
|
|
27
|
+
var import_react = __toESM(require_react(), 1);
|
|
28
|
+
var VIEW_MODE_STORAGE_KEY = "nolo-space-view-mode";
|
|
29
|
+
var readStoredViewMode = () => {
|
|
30
|
+
try {
|
|
31
|
+
if (typeof window === "undefined") return "all";
|
|
32
|
+
return window.localStorage.getItem(VIEW_MODE_STORAGE_KEY) === "categories" ? "categories" : "all";
|
|
33
|
+
} catch {
|
|
34
|
+
return "all";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var writeStoredViewMode = (mode) => {
|
|
38
|
+
try {
|
|
39
|
+
if (typeof window === "undefined") return;
|
|
40
|
+
window.localStorage.setItem(VIEW_MODE_STORAGE_KEY, mode);
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var createInitialState = () => ({
|
|
45
|
+
currentSpaceId: null,
|
|
46
|
+
currentSpace: null,
|
|
47
|
+
viewMode: readStoredViewMode()
|
|
48
|
+
});
|
|
49
|
+
var state = createInitialState();
|
|
50
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
51
|
+
var version = 0;
|
|
52
|
+
var notify = () => {
|
|
53
|
+
version += 1;
|
|
54
|
+
for (const listener of listeners) {
|
|
55
|
+
try {
|
|
56
|
+
listener();
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function getCurrentSpaceId() {
|
|
62
|
+
return state.viewMode === "all" ? null : state.currentSpaceId;
|
|
63
|
+
}
|
|
64
|
+
function getCurrentSpaceIdRaw() {
|
|
65
|
+
return state.currentSpaceId;
|
|
66
|
+
}
|
|
67
|
+
function getCurrentSpaceRaw() {
|
|
68
|
+
return state.currentSpace;
|
|
69
|
+
}
|
|
70
|
+
function getViewMode() {
|
|
71
|
+
return state.viewMode;
|
|
72
|
+
}
|
|
73
|
+
function setViewMode(mode) {
|
|
74
|
+
if (state.viewMode === mode) return;
|
|
75
|
+
state = { ...state, viewMode: mode };
|
|
76
|
+
writeStoredViewMode(mode);
|
|
77
|
+
notify();
|
|
78
|
+
}
|
|
79
|
+
function setCurrentSpace(space) {
|
|
80
|
+
state = { ...state, currentSpace: space };
|
|
81
|
+
notify();
|
|
82
|
+
}
|
|
83
|
+
function setCurrentSpaceBoth(spaceId, space) {
|
|
84
|
+
state = { ...state, currentSpaceId: spaceId, currentSpace: space };
|
|
85
|
+
notify();
|
|
86
|
+
}
|
|
87
|
+
function updateCurrentSpaceIfMatch(spaceId, space) {
|
|
88
|
+
const currentId = state.currentSpaceId;
|
|
89
|
+
if (currentId && normalizeSpaceId(currentId) === normalizeSpaceId(spaceId)) {
|
|
90
|
+
state = { ...state, currentSpace: space };
|
|
91
|
+
notify();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// packages/create/space/member/membershipRequestGeneration.ts
|
|
96
|
+
var membershipRequestSeq = 0;
|
|
97
|
+
function beginMembershipRequest() {
|
|
98
|
+
membershipRequestSeq += 1;
|
|
99
|
+
return membershipRequestSeq;
|
|
100
|
+
}
|
|
101
|
+
function getLatestMembershipRequestId() {
|
|
102
|
+
return membershipRequestSeq;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// packages/create/space/spaceMembershipStore.ts
|
|
106
|
+
var import_react2 = __toESM(require_react(), 1);
|
|
107
|
+
var createInitialState2 = () => ({
|
|
108
|
+
memberSpaces: null,
|
|
109
|
+
loading: false,
|
|
110
|
+
membershipStatus: "idle",
|
|
111
|
+
initialized: false
|
|
112
|
+
});
|
|
113
|
+
var state2 = createInitialState2();
|
|
114
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
115
|
+
var version2 = 0;
|
|
116
|
+
var notify2 = () => {
|
|
117
|
+
version2 += 1;
|
|
118
|
+
for (const listener of listeners2) {
|
|
119
|
+
try {
|
|
120
|
+
listener();
|
|
121
|
+
} catch {
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var getMembershipUpdatedAt = (space) => {
|
|
126
|
+
if (!space) return 0;
|
|
127
|
+
return toTimestampMs(
|
|
128
|
+
space.spaceUpdatedAt ?? space.memberUpdatedAt ?? space.updatedAt ?? space.createdAt ?? space.joinedAt
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
function dedupeMemberSpacesById(memberSpaces) {
|
|
132
|
+
const membershipMap = /* @__PURE__ */ new Map();
|
|
133
|
+
memberSpaces.forEach((space) => {
|
|
134
|
+
const prev = membershipMap.get(space.spaceId);
|
|
135
|
+
if (!prev || getMembershipUpdatedAt(space) >= getMembershipUpdatedAt(prev)) {
|
|
136
|
+
membershipMap.set(space.spaceId, space);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return Array.from(membershipMap.values());
|
|
140
|
+
}
|
|
141
|
+
function getAllMemberSpaces() {
|
|
142
|
+
const memberSpaces = dedupeMemberSpacesById(state2.memberSpaces || []);
|
|
143
|
+
return [...memberSpaces].sort((a, b) => {
|
|
144
|
+
return getMembershipUpdatedAt(b) - getMembershipUpdatedAt(a);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function setMemberSpaces(spaces) {
|
|
148
|
+
state2 = {
|
|
149
|
+
...state2,
|
|
150
|
+
memberSpaces: spaces,
|
|
151
|
+
loading: false,
|
|
152
|
+
error: void 0,
|
|
153
|
+
membershipStatus: "fresh",
|
|
154
|
+
initialized: true
|
|
155
|
+
};
|
|
156
|
+
notify2();
|
|
157
|
+
}
|
|
158
|
+
function setMembershipLoading() {
|
|
159
|
+
state2 = { ...state2, loading: true, membershipStatus: "loading" };
|
|
160
|
+
notify2();
|
|
161
|
+
}
|
|
162
|
+
function setMembershipRejected(errorMessage, isRemoteUnavailable) {
|
|
163
|
+
const membershipStatus = isRemoteUnavailable ? "offline" : state2.membershipStatus === "loading" ? "idle" : state2.membershipStatus;
|
|
164
|
+
state2 = {
|
|
165
|
+
...state2,
|
|
166
|
+
loading: false,
|
|
167
|
+
error: errorMessage,
|
|
168
|
+
membershipStatus
|
|
169
|
+
};
|
|
170
|
+
notify2();
|
|
171
|
+
}
|
|
172
|
+
function setMembershipDiscarded() {
|
|
173
|
+
state2 = {
|
|
174
|
+
...state2,
|
|
175
|
+
loading: false,
|
|
176
|
+
membershipStatus: state2.membershipStatus === "loading" ? "idle" : state2.membershipStatus
|
|
177
|
+
};
|
|
178
|
+
notify2();
|
|
179
|
+
}
|
|
180
|
+
function appendRecoveredMemberships(recovered) {
|
|
181
|
+
if (!recovered || recovered.length === 0) return;
|
|
182
|
+
if (state2.memberSpaces === null) {
|
|
183
|
+
state2 = {
|
|
184
|
+
...state2,
|
|
185
|
+
memberSpaces: dedupeMemberSpacesById(recovered)
|
|
186
|
+
};
|
|
187
|
+
notify2();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
state2 = {
|
|
191
|
+
...state2,
|
|
192
|
+
memberSpaces: dedupeMemberSpacesById([
|
|
193
|
+
...state2.memberSpaces,
|
|
194
|
+
...recovered
|
|
195
|
+
]).sort((a, b) => toTimestampMs(b.joinedAt) - toTimestampMs(a.joinedAt))
|
|
196
|
+
};
|
|
197
|
+
notify2();
|
|
198
|
+
}
|
|
199
|
+
function setSpaceInitialized() {
|
|
200
|
+
state2 = { ...state2, initialized: true };
|
|
201
|
+
notify2();
|
|
202
|
+
}
|
|
203
|
+
function setMembershipLoaded() {
|
|
204
|
+
state2 = { ...state2, loading: false, error: void 0 };
|
|
205
|
+
notify2();
|
|
206
|
+
}
|
|
207
|
+
function addMemberSpace(space) {
|
|
208
|
+
const existing = state2.memberSpaces || [];
|
|
209
|
+
state2 = {
|
|
210
|
+
...state2,
|
|
211
|
+
memberSpaces: dedupeMemberSpacesById([...existing, space])
|
|
212
|
+
};
|
|
213
|
+
notify2();
|
|
214
|
+
}
|
|
215
|
+
function removeMemberSpace(spaceId) {
|
|
216
|
+
if (!state2.memberSpaces) return;
|
|
217
|
+
const normalized = normalizeSpaceId(spaceId);
|
|
218
|
+
state2 = {
|
|
219
|
+
...state2,
|
|
220
|
+
memberSpaces: state2.memberSpaces.filter(
|
|
221
|
+
(s) => normalizeSpaceId(s.spaceId) !== normalized
|
|
222
|
+
)
|
|
223
|
+
};
|
|
224
|
+
notify2();
|
|
225
|
+
}
|
|
226
|
+
function updateMemberSpaceName(spaceId, name) {
|
|
227
|
+
if (!state2.memberSpaces || !name) return;
|
|
228
|
+
state2 = {
|
|
229
|
+
...state2,
|
|
230
|
+
memberSpaces: state2.memberSpaces.map(
|
|
231
|
+
(space) => space.spaceId === spaceId ? { ...space, spaceName: name } : space
|
|
232
|
+
)
|
|
233
|
+
};
|
|
234
|
+
notify2();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// packages/create/space/spaceApiClient.ts
|
|
238
|
+
var SPACE_API_TIMEOUT_MS = 1e4;
|
|
239
|
+
var SpaceApiError = class extends Error {
|
|
240
|
+
status;
|
|
241
|
+
code;
|
|
242
|
+
constructor(status, code, message) {
|
|
243
|
+
super(message);
|
|
244
|
+
this.name = "SpaceApiError";
|
|
245
|
+
this.status = status;
|
|
246
|
+
this.code = code;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
function isDesktopEmbeddedOrigin(origin) {
|
|
250
|
+
if (typeof window === "undefined") return false;
|
|
251
|
+
const shellWindow = window;
|
|
252
|
+
if (shellWindow.__NOLO_EMBEDDED_RUNTIME__ !== true) return false;
|
|
253
|
+
const runtimeOrigin = shellWindow.location?.origin?.replace(/\/+$/, "");
|
|
254
|
+
return Boolean(runtimeOrigin && origin === runtimeOrigin);
|
|
255
|
+
}
|
|
256
|
+
function resolveSpaceApiTarget(state3, options) {
|
|
257
|
+
const rawToken = options?.token ?? (typeof selectIdentityToken === "function" ? selectIdentityToken(state3) : null);
|
|
258
|
+
const token = (rawToken ?? "").trim();
|
|
259
|
+
if (!token) return null;
|
|
260
|
+
let candidates;
|
|
261
|
+
if (options?.serverOrigin !== void 0) {
|
|
262
|
+
candidates = [options.serverOrigin];
|
|
263
|
+
} else {
|
|
264
|
+
const { currentServer, syncServers } = getRuntimeServerSnapshot(state3);
|
|
265
|
+
candidates = scopeGoogleSessionServers(
|
|
266
|
+
token,
|
|
267
|
+
currentServer,
|
|
268
|
+
getAllServers(currentServer, [...syncServers])
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
for (const raw of candidates) {
|
|
272
|
+
if (typeof raw !== "string") continue;
|
|
273
|
+
const normalized = raw.trim().replace(/\/+$/, "");
|
|
274
|
+
if (!normalized) continue;
|
|
275
|
+
if (isDesktopEmbeddedOrigin(normalized)) continue;
|
|
276
|
+
return { token, serverOrigin: normalized };
|
|
277
|
+
}
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
function canUseRemoteSpaceApi(state3, options) {
|
|
281
|
+
return resolveSpaceApiTarget(state3, options) !== null;
|
|
282
|
+
}
|
|
283
|
+
async function callSpaceApi(state3, method, path, body, options) {
|
|
284
|
+
if (!path.startsWith("/") || path.startsWith("//")) {
|
|
285
|
+
throw new SpaceApiError(400, "invalid_path", `Invalid Space API path "${path}".`);
|
|
286
|
+
}
|
|
287
|
+
const target = resolveSpaceApiTarget(state3, options);
|
|
288
|
+
if (!target) {
|
|
289
|
+
throw new SpaceApiError(0, "no_server", "No authenticated server available for Space API.");
|
|
290
|
+
}
|
|
291
|
+
const requestUrl = `${target.serverOrigin}${path}`;
|
|
292
|
+
const doFetch = options?.fetchImpl ?? fetch;
|
|
293
|
+
const timeoutMs = options?.timeoutMs ?? SPACE_API_TIMEOUT_MS;
|
|
294
|
+
const controller = new AbortController();
|
|
295
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
296
|
+
try {
|
|
297
|
+
const requestToken = googleSessionRequestToken(target.token, requestUrl);
|
|
298
|
+
const response = await doFetch(requestUrl, {
|
|
299
|
+
method,
|
|
300
|
+
...isGoogleAuthoritySession(target.token) ? { redirect: "error", credentials: "omit" } : {},
|
|
301
|
+
headers: {
|
|
302
|
+
Authorization: `Bearer ${requestToken}`,
|
|
303
|
+
...body !== void 0 ? { "Content-Type": "application/json" } : {}
|
|
304
|
+
},
|
|
305
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {},
|
|
306
|
+
signal: controller.signal
|
|
307
|
+
});
|
|
308
|
+
if (!response.ok) {
|
|
309
|
+
const payload2 = await response.json().catch(() => null);
|
|
310
|
+
const errObj = payload2 && typeof payload2 === "object" ? payload2 : null;
|
|
311
|
+
throw new SpaceApiError(
|
|
312
|
+
response.status,
|
|
313
|
+
typeof errObj?.code === "string" ? errObj.code : `http_${response.status}`,
|
|
314
|
+
typeof errObj?.error === "string" ? errObj.error : typeof errObj?.message === "string" ? errObj.message : `Space API request failed with HTTP ${response.status}`
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
if (response.status === 204 || response.headers.get("content-length") === "0") {
|
|
318
|
+
return { ok: true };
|
|
319
|
+
}
|
|
320
|
+
let payload;
|
|
321
|
+
try {
|
|
322
|
+
payload = await response.json();
|
|
323
|
+
} catch {
|
|
324
|
+
throw new SpaceApiError(
|
|
325
|
+
response.status,
|
|
326
|
+
"invalid_response",
|
|
327
|
+
"Space API returned a non-JSON response."
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
if (!payload || typeof payload !== "object") {
|
|
331
|
+
throw new SpaceApiError(
|
|
332
|
+
response.status,
|
|
333
|
+
"invalid_response",
|
|
334
|
+
"Space API returned an unexpected payload."
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
return payload;
|
|
338
|
+
} catch (err) {
|
|
339
|
+
if (err instanceof SpaceApiError) throw err;
|
|
340
|
+
if (controller.signal.aborted || err?.name === "AbortError") {
|
|
341
|
+
throw new SpaceApiError(0, "timeout", `Space API request timed out after ${timeoutMs}ms.`);
|
|
342
|
+
}
|
|
343
|
+
throw new SpaceApiError(
|
|
344
|
+
0,
|
|
345
|
+
"network_error",
|
|
346
|
+
err instanceof Error ? err.message : String(err)
|
|
347
|
+
);
|
|
348
|
+
} finally {
|
|
349
|
+
clearTimeout(timer);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// packages/create/space/dbMutateClient.ts
|
|
354
|
+
var MAX_DB_MUTATE_OPS = 100;
|
|
355
|
+
var INVALID_SEGMENT_CHAR_RE = /[:/\s\0\uffff]/;
|
|
356
|
+
var MAX_SEGMENT_LEN = 256;
|
|
357
|
+
function isValidClientSegment(value) {
|
|
358
|
+
return value.length > 0 && value.length <= MAX_SEGMENT_LEN && !INVALID_SEGMENT_CHAR_RE.test(value);
|
|
359
|
+
}
|
|
360
|
+
function requireSpaceSegment(rawSpaceId) {
|
|
361
|
+
const normalized = normalizeSpaceId(typeof rawSpaceId === "string" ? rawSpaceId.trim() : "");
|
|
362
|
+
if (!isValidClientSegment(normalized)) {
|
|
363
|
+
throw new SpaceApiError(400, "invalid_spaceId", "spaceId is invalid.");
|
|
364
|
+
}
|
|
365
|
+
return normalized;
|
|
366
|
+
}
|
|
367
|
+
function requireKeySegment(raw, fieldName) {
|
|
368
|
+
const trimmed = typeof raw === "string" ? raw.trim() : "";
|
|
369
|
+
if (!isValidClientSegment(trimmed)) {
|
|
370
|
+
throw new SpaceApiError(400, `invalid_${fieldName}`, `${fieldName} is invalid.`);
|
|
371
|
+
}
|
|
372
|
+
return trimmed;
|
|
373
|
+
}
|
|
374
|
+
function requireContentKeySegment(raw) {
|
|
375
|
+
const trimmed = typeof raw === "string" ? raw.trim() : "";
|
|
376
|
+
if (!trimmed || trimmed.length > MAX_SEGMENT_LEN || /[\s\0\uffff]/.test(trimmed)) {
|
|
377
|
+
throw new SpaceApiError(400, "invalid_contentKey", "contentKey is invalid.");
|
|
378
|
+
}
|
|
379
|
+
return trimmed;
|
|
380
|
+
}
|
|
381
|
+
var spMetaKey = (spaceId) => `sp:${requireSpaceSegment(spaceId)}:meta`;
|
|
382
|
+
var spCatKey = (spaceId, categoryId) => `sp:${requireSpaceSegment(spaceId)}:cat:${requireKeySegment(categoryId, "categoryId")}`;
|
|
383
|
+
var spItemKey = (spaceId, contentKey) => `sp:${requireSpaceSegment(spaceId)}:item:${requireContentKeySegment(contentKey)}`;
|
|
384
|
+
var spMemKey = (spaceId, userId) => `sp:${requireSpaceSegment(spaceId)}:mem:${requireKeySegment(userId, "userId")}`;
|
|
385
|
+
async function mutateDbOps(state3, ops, options) {
|
|
386
|
+
if (!Array.isArray(ops) || ops.length === 0) {
|
|
387
|
+
throw new SpaceApiError(400, "invalid_ops", "ops must be a non-empty array.");
|
|
388
|
+
}
|
|
389
|
+
if (ops.length > MAX_DB_MUTATE_OPS) {
|
|
390
|
+
throw new SpaceApiError(
|
|
391
|
+
400,
|
|
392
|
+
"too_many_ops",
|
|
393
|
+
`At most ${MAX_DB_MUTATE_OPS} operations are allowed per mutate batch.`
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
return callSpaceApi(state3, "POST", "/api/v1/db/mutate", { ops }, options);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// packages/create/space/spaceRemoteSync.ts
|
|
400
|
+
function isRemoteAccountSpace(spaceData, state3, options) {
|
|
401
|
+
if (!spaceData) return false;
|
|
402
|
+
return !isDeviceLocalSpaceBody(spaceData) && canUseRemoteSpaceApi(state3, options);
|
|
403
|
+
}
|
|
404
|
+
async function syncLocalSpaceEntityCache(thunkAPI, spaceKey, updatedSpaceData) {
|
|
405
|
+
const entity = updatedSpaceData.dbKey ? updatedSpaceData : { ...updatedSpaceData, dbKey: spaceKey };
|
|
406
|
+
const localDb = thunkAPI?.extra?.db;
|
|
407
|
+
if (localDb && typeof localDb.put === "function") {
|
|
408
|
+
await localDb.put(spaceKey, entity).catch((err) => {
|
|
409
|
+
console.warn("[spaceRemoteSync] localDb.put failed:", spaceKey, err);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
if (typeof upsertSSREntity === "function" && typeof thunkAPI?.dispatch === "function") {
|
|
413
|
+
thunkAPI.dispatch(upsertSSREntity(entity));
|
|
414
|
+
}
|
|
415
|
+
return entity;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export {
|
|
419
|
+
getCurrentSpaceId,
|
|
420
|
+
getCurrentSpaceIdRaw,
|
|
421
|
+
getCurrentSpaceRaw,
|
|
422
|
+
getViewMode,
|
|
423
|
+
setViewMode,
|
|
424
|
+
setCurrentSpace,
|
|
425
|
+
setCurrentSpaceBoth,
|
|
426
|
+
updateCurrentSpaceIfMatch,
|
|
427
|
+
canUseRemoteSpaceApi,
|
|
428
|
+
MAX_DB_MUTATE_OPS,
|
|
429
|
+
spMetaKey,
|
|
430
|
+
spCatKey,
|
|
431
|
+
spItemKey,
|
|
432
|
+
spMemKey,
|
|
433
|
+
mutateDbOps,
|
|
434
|
+
isRemoteAccountSpace,
|
|
435
|
+
syncLocalSpaceEntityCache,
|
|
436
|
+
beginMembershipRequest,
|
|
437
|
+
getLatestMembershipRequestId,
|
|
438
|
+
getAllMemberSpaces,
|
|
439
|
+
setMemberSpaces,
|
|
440
|
+
setMembershipLoading,
|
|
441
|
+
setMembershipRejected,
|
|
442
|
+
setMembershipDiscarded,
|
|
443
|
+
appendRecoveredMemberships,
|
|
444
|
+
setSpaceInitialized,
|
|
445
|
+
setMembershipLoaded,
|
|
446
|
+
addMemberSpace,
|
|
447
|
+
removeMemberSpace,
|
|
448
|
+
updateMemberSpaceName
|
|
449
|
+
};
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
getOrCreateSharedStore,
|
|
4
4
|
isCliProviderAgentConfig,
|
|
5
5
|
summarizeEndpoint
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QAW6BEWQ.js";
|
|
7
7
|
import {
|
|
8
8
|
attachExecutionStoppedPromise,
|
|
9
9
|
getExecutionStoppedPromise
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DALXH7BG.js";
|
|
11
11
|
import {
|
|
12
12
|
isCursorOAuthAgent
|
|
13
13
|
} from "./chunk-VIWDGTDA.js";
|
|
14
14
|
import {
|
|
15
15
|
clipMultilineText
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZSZBHRLP.js";
|
|
17
17
|
import {
|
|
18
18
|
DialogTurnBusyError,
|
|
19
19
|
acquireLocalDialogTurnLease,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
clipMultilineText,
|
|
3
3
|
fetchAndSerializeTable,
|
|
4
4
|
waitForAbortableDelay
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZSZBHRLP.js";
|
|
6
6
|
import {
|
|
7
7
|
isGatewayHttpStatus
|
|
8
8
|
} from "./chunk-NF64D32W.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-AGIM7IMJ.js";
|
|
16
16
|
import {
|
|
17
17
|
fetchAndCacheMessages
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DBCWXGOC.js";
|
|
19
19
|
import {
|
|
20
20
|
createSpaceKey
|
|
21
21
|
} from "./chunk-UAD2WT54.js";
|
|
@@ -3,27 +3,27 @@ import {
|
|
|
3
3
|
mergeReferences,
|
|
4
4
|
resolveReferenceAssets,
|
|
5
5
|
resolveToolsFromKeys
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LYPJYBE5.js";
|
|
7
7
|
import {
|
|
8
8
|
UI_CARD_ENVELOPE_MAX_BYTES,
|
|
9
9
|
getAllToolRuns,
|
|
10
10
|
parseUiCard,
|
|
11
11
|
uiCardFallback
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZSZBHRLP.js";
|
|
13
13
|
import {
|
|
14
14
|
getDocState
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7E6YXSFZ.js";
|
|
16
16
|
import {
|
|
17
17
|
getTableState
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TGVVE5BA.js";
|
|
19
19
|
import {
|
|
20
20
|
getCurrentSpaceIdRaw,
|
|
21
21
|
getViewMode
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JDMWYVUF.js";
|
|
23
23
|
import {
|
|
24
24
|
getMessageStore,
|
|
25
25
|
selectAllMsgs
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-DBCWXGOC.js";
|
|
27
27
|
import {
|
|
28
28
|
resolveToolBaseUrl
|
|
29
29
|
} from "./chunk-OQH3TAB7.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
runAgentTurn,
|
|
11
11
|
shouldPrintLocalRunSummary,
|
|
12
12
|
unknownLocalRunAcceptance
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4UNN45DS.js";
|
|
14
14
|
import {
|
|
15
15
|
getReadableCliDb
|
|
16
16
|
} from "./chunk-LRLLWD4P.js";
|
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
resolveServerUrl,
|
|
29
29
|
validateInstaboxWorkspaceSelection,
|
|
30
30
|
writeUsage
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-QAW6BEWQ.js";
|
|
32
32
|
import {
|
|
33
33
|
CliProviderQuotaError
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-DALXH7BG.js";
|
|
35
35
|
import {
|
|
36
36
|
parsePositiveFiniteNumberOrFallback
|
|
37
37
|
} from "./chunk-Y5GCAMGP.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-56OAS5RZ.js";
|
|
4
4
|
import {
|
|
5
5
|
performServerProxyFetchWithRetry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LYPJYBE5.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchServerSyncedCredential
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TKLBBR7P.js";
|
|
10
10
|
import {
|
|
11
11
|
getRuntimeServerSnapshot,
|
|
12
12
|
getSessionSnapshotForState,
|
|
@@ -361,7 +361,7 @@ function createLocalAutomationScheduler(deps) {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
// packages/cli/automation/localAutomationRuntime.ts
|
|
364
|
-
function createLocalAutomationExecutor({ env, scriptDir, output }, runTurn = async (options) => (await import("./agentRun-
|
|
364
|
+
function createLocalAutomationExecutor({ env, scriptDir, output }, runTurn = async (options) => (await import("./agentRun-UIO43TUG.js")).runAgentTurn(options)) {
|
|
365
365
|
return async (record, signal) => {
|
|
366
366
|
signal.throwIfAborted();
|
|
367
367
|
const result = await runTurn({
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
executeCli,
|
|
59
59
|
executeCliStreaming,
|
|
60
60
|
getExecutionStoppedPromise
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-DALXH7BG.js";
|
|
62
62
|
import {
|
|
63
63
|
isCursorOAuthAgent
|
|
64
64
|
} from "./chunk-VIWDGTDA.js";
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
import {
|
|
72
72
|
inlineImageUrlsForCustomProvider,
|
|
73
73
|
prepareTools
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-DBEOW57U.js";
|
|
75
75
|
import {
|
|
76
76
|
getServerProviderSecret
|
|
77
77
|
} from "./chunk-56OAS5RZ.js";
|
|
@@ -94,17 +94,17 @@ import {
|
|
|
94
94
|
resolveCliLocalSpawnDispatch,
|
|
95
95
|
resolveRunContextFacts,
|
|
96
96
|
resolveStartAgentRunCwd
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-EBH4RFJ6.js";
|
|
98
98
|
import {
|
|
99
99
|
normalizeEnabledPromptSkills,
|
|
100
100
|
resolveUserEnabledSkills
|
|
101
101
|
} from "./chunk-P62DHV4F.js";
|
|
102
102
|
import {
|
|
103
103
|
validateAskChoiceInput
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-HXEO5DNV.js";
|
|
105
105
|
import {
|
|
106
106
|
prepareTokenUsageData
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-DBCWXGOC.js";
|
|
108
108
|
import {
|
|
109
109
|
applyTokenUsageToDayStats
|
|
110
110
|
} from "./chunk-KDDXC2IH.js";
|
|
@@ -114,7 +114,7 @@ import {
|
|
|
114
114
|
} from "./chunk-FGXG6OLW.js";
|
|
115
115
|
import {
|
|
116
116
|
fetchServerSyncedCredential
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-TKLBBR7P.js";
|
|
118
118
|
import {
|
|
119
119
|
formatLocalDate
|
|
120
120
|
} from "./chunk-PL5RKESU.js";
|