castle-web-cli 0.4.227 → 0.4.229
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/agent-prompts.d.ts +9 -3
- package/dist/agent-prompts.js +140 -48
- package/dist/agent.js +127 -14
- package/dist/api.d.ts +37 -0
- package/dist/api.js +29 -0
- package/dist/castle-host/host.d.ts +6 -0
- package/dist/castle-host/host.js +42 -3
- package/dist/castleJson.d.ts +15 -0
- package/dist/castleJson.js +136 -3
- package/dist/cloudGit.d.ts +27 -1
- package/dist/cloudGit.js +359 -24
- package/dist/cloudGitServe.js +9 -5
- package/dist/gitCollaborators.d.ts +16 -0
- package/dist/gitCollaborators.js +42 -0
- package/dist/gitIncoming.d.ts +17 -0
- package/dist/gitIncoming.js +113 -0
- package/dist/gitRemote.js +2 -2
- package/dist/imports.js +4 -2
- package/dist/index.js +5 -0
- package/dist/init.js +1 -1
- package/dist/native/playtest-browser.js +13 -1
- package/dist/platformDoc.js +1 -1
- package/dist/save-deck.js +3 -0
- package/dist/serve.js +17 -0
- package/dist/shell/assets/index-Cf61cNfT.css +1 -0
- package/dist/shell/assets/{index-D006JHww.js → index-D2tWM896.js} +71 -71
- package/dist/shell/index.html +2 -2
- package/dist/sourceLineage.d.ts +42 -0
- package/dist/sourceLineage.js +380 -0
- package/dist/webSourceSync.d.ts +9 -0
- package/dist/webSourceSync.js +24 -9
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/README.md +81 -0
- package/kits/base/sdk/castle.d.ts +1 -1
- package/kits/base/sdk/commands.d.ts +6 -0
- package/kits/base/sdk/multiplayer.d.ts +44 -6
- package/kits/base/sdk/multiplayer.js +62 -1
- package/kits/base/sdk/server/platformHandle.d.ts +9 -1
- package/kits/base/sdk/server/wrapper.d.ts +111 -4
- package/kits/base/sdk/server/wrapper.js +650 -24
- package/package.json +10 -2
- package/dist/shell/assets/index-BxDYy_-C.css +0 -1
package/dist/api.js
CHANGED
|
@@ -103,6 +103,24 @@ export async function whoAmI() {
|
|
|
103
103
|
handleAPIError(data);
|
|
104
104
|
return pickData(data, 'me');
|
|
105
105
|
}
|
|
106
|
+
export async function reportDeckEditorPresence(deckId) {
|
|
107
|
+
const data = await graphql(`mutation($deckId: ID!) {
|
|
108
|
+
reportDeckEditorPresence(deckId: $deckId) {
|
|
109
|
+
userId username photo { url } lastSeenAt
|
|
110
|
+
}
|
|
111
|
+
}`, { deckId });
|
|
112
|
+
handleAPIError(data);
|
|
113
|
+
return pickData(data, 'reportDeckEditorPresence') ?? [];
|
|
114
|
+
}
|
|
115
|
+
export async function deckCollaborators(deckId) {
|
|
116
|
+
const data = await graphql(`query($deckId: ID!) {
|
|
117
|
+
deckCollaborators(deckId: $deckId) {
|
|
118
|
+
userId username photo { url } addedAt
|
|
119
|
+
}
|
|
120
|
+
}`, { deckId });
|
|
121
|
+
handleAPIError(data);
|
|
122
|
+
return pickData(data, 'deckCollaborators') ?? [];
|
|
123
|
+
}
|
|
106
124
|
// Everything an import-picker row shows for one deck: what it is, whose it is,
|
|
107
125
|
// what it looks like, and who it was remixed from. One fragment, so the three
|
|
108
126
|
// list queries below can't drift apart.
|
|
@@ -292,6 +310,17 @@ export async function webDeckSource(deckId) {
|
|
|
292
310
|
handleAPIError(data);
|
|
293
311
|
return pickData(data, 'webDeckSource');
|
|
294
312
|
}
|
|
313
|
+
// Every saved version of the deck's source, newest first (Ghost lists at most 50), for its
|
|
314
|
+
// creator or an edit collaborator. A Ghost without the field fails this, as does anyone else.
|
|
315
|
+
export async function savedSourceHistory(deckId, timeoutMs) {
|
|
316
|
+
const data = await graphql(`query($deckId: ID!) {
|
|
317
|
+
webDeckSourceVersions(deckId: $deckId) {
|
|
318
|
+
s3Key archiveUrl savedAt bytes
|
|
319
|
+
}
|
|
320
|
+
}`, { deckId }, timeoutMs === undefined ? {} : { timeoutMs: Math.max(1, timeoutMs) });
|
|
321
|
+
handleAPIError(data);
|
|
322
|
+
return pickData(data, 'webDeckSourceVersions');
|
|
323
|
+
}
|
|
295
324
|
// Starts every leaderboard on the deck over from empty. Ghost allows it only for
|
|
296
325
|
// the deck's creator.
|
|
297
326
|
export async function clearDeckLeaderboards(deckId) {
|
|
@@ -14,6 +14,12 @@ export interface HostContext {
|
|
|
14
14
|
isAnonymous?: boolean;
|
|
15
15
|
deepLinkUri?: string | null;
|
|
16
16
|
partyId?: string | null;
|
|
17
|
+
joinHint?: {
|
|
18
|
+
deckId: string;
|
|
19
|
+
sessionId?: string | null;
|
|
20
|
+
routeId?: string | null;
|
|
21
|
+
slot?: string | null;
|
|
22
|
+
} | null;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
export interface GraphqlError {
|
package/dist/castle-host/host.js
CHANGED
|
@@ -40,6 +40,7 @@ const COMMAND_NAMES = [
|
|
|
40
40
|
"portal.info",
|
|
41
41
|
"haptics.play",
|
|
42
42
|
"multiplayer.getSession",
|
|
43
|
+
"multiplayer.getJoinHint",
|
|
43
44
|
"multiplayer.joinDestination",
|
|
44
45
|
"voice.getState",
|
|
45
46
|
"voice.requestJoin",
|
|
@@ -188,6 +189,8 @@ function runCommand(ctx, command, params, caps, options) {
|
|
|
188
189
|
return passHas(ctx, params, caps);
|
|
189
190
|
case "multiplayer.getSession":
|
|
190
191
|
return multiplayerGetSession(ctx, params, caps);
|
|
192
|
+
case "multiplayer.getJoinHint":
|
|
193
|
+
return Promise.resolve(multiplayerGetJoinHint(ctx));
|
|
191
194
|
case "voice.getState":
|
|
192
195
|
return voiceGetState(ctx, params, caps);
|
|
193
196
|
case "voice.requestJoin":
|
|
@@ -240,13 +243,47 @@ function runCommand(ctx, command, params, caps, options) {
|
|
|
240
243
|
async function multiplayerGetSession(ctx, params, caps) {
|
|
241
244
|
const request = multiplayerSessionRequest(params);
|
|
242
245
|
const deckId = requireDeckId(ctx, "multiplayer.getSession");
|
|
246
|
+
const hintedSessionId = multiplayerHintedSessionId(ctx, deckId);
|
|
243
247
|
// Which shared session a play belongs to is the host's call, not the deck's,
|
|
244
248
|
// the way `shared.cpp` reads the party off the engine rather than the scene.
|
|
245
|
-
// A play that arrived through a party stays inside it
|
|
246
|
-
|
|
247
|
-
const
|
|
249
|
+
// A play that arrived through a party stays inside it unless trusted host
|
|
250
|
+
// chrome is sending this public join to the room where a friend is playing.
|
|
251
|
+
const mode = request.mode === "public" && ctx.partyId && !hintedSessionId
|
|
252
|
+
? "party"
|
|
253
|
+
: request.mode;
|
|
254
|
+
const data = await graphql(caps.graphqlFetch, CAULDRON_MULTIPLAYER_SESSION_QUERY, {
|
|
255
|
+
deckId,
|
|
256
|
+
mode,
|
|
257
|
+
key: request.key ?? null,
|
|
258
|
+
sessionId: request.mode === "public" ? hintedSessionId : null,
|
|
259
|
+
partyId: ctx.partyId ?? null,
|
|
260
|
+
}, "multiplayer.getSession");
|
|
248
261
|
return multiplayerSessionResult(data.getCauldronMultiplayerSession);
|
|
249
262
|
}
|
|
263
|
+
const MULTIPLAYER_SESSION_ID_MAX_LENGTH = 256;
|
|
264
|
+
function multiplayerHintedSessionId(ctx, deckId) {
|
|
265
|
+
const hint = ctx.joinHint;
|
|
266
|
+
if (!hint || hint.deckId !== deckId)
|
|
267
|
+
return null;
|
|
268
|
+
return typeof hint.sessionId === "string" &&
|
|
269
|
+
hint.sessionId.length > 0 &&
|
|
270
|
+
hint.sessionId.length <= MULTIPLAYER_SESSION_ID_MAX_LENGTH
|
|
271
|
+
? hint.sessionId
|
|
272
|
+
: null;
|
|
273
|
+
}
|
|
274
|
+
function multiplayerGetJoinHint(ctx) {
|
|
275
|
+
const hint = ctx.joinHint;
|
|
276
|
+
if (!ctx.deckId ||
|
|
277
|
+
!hint ||
|
|
278
|
+
hint.deckId !== ctx.deckId ||
|
|
279
|
+
typeof hint.routeId !== "string" ||
|
|
280
|
+
hint.routeId.length === 0 ||
|
|
281
|
+
typeof hint.slot !== "string" ||
|
|
282
|
+
hint.slot.length === 0) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
return { routeId: hint.routeId, slot: hint.slot };
|
|
286
|
+
}
|
|
250
287
|
function multiplayerSessionRequest(params) {
|
|
251
288
|
const mode = asMultiplayerMode(params.mode);
|
|
252
289
|
return {
|
|
@@ -2421,12 +2458,14 @@ const CAULDRON_MULTIPLAYER_SESSION_QUERY = `
|
|
|
2421
2458
|
$deckId: ID!
|
|
2422
2459
|
$mode: String!
|
|
2423
2460
|
$key: String
|
|
2461
|
+
$sessionId: ID
|
|
2424
2462
|
$partyId: ID
|
|
2425
2463
|
) {
|
|
2426
2464
|
getCauldronMultiplayerSession(
|
|
2427
2465
|
deckId: $deckId
|
|
2428
2466
|
mode: $mode
|
|
2429
2467
|
key: $key
|
|
2468
|
+
sessionId: $sessionId
|
|
2430
2469
|
partyId: $partyId
|
|
2431
2470
|
) {
|
|
2432
2471
|
sessionId
|
package/dist/castleJson.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface CastleJson {
|
|
|
27
27
|
tickRate?: number;
|
|
28
28
|
maxPlayers?: number;
|
|
29
29
|
destinations?: ServerDestinationConfig[];
|
|
30
|
+
worldNotifications?: ServerWorldNotificationsConfig;
|
|
30
31
|
};
|
|
31
32
|
voice?: {
|
|
32
33
|
enabled?: boolean;
|
|
@@ -47,14 +48,28 @@ export interface ServerDestinationConfig {
|
|
|
47
48
|
selection: 'exact' | 'find';
|
|
48
49
|
persistence: 'transient' | 'world';
|
|
49
50
|
characters?: 'shared';
|
|
51
|
+
worldTime?: {
|
|
52
|
+
advance: 'wallClock';
|
|
53
|
+
};
|
|
50
54
|
maxPlayers: number;
|
|
51
55
|
}
|
|
56
|
+
export interface ServerWorldNotificationTemplateConfig {
|
|
57
|
+
id: string;
|
|
58
|
+
text: string;
|
|
59
|
+
slots: string[];
|
|
60
|
+
timeSensitive?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ServerWorldNotificationsConfig {
|
|
63
|
+
version: 1;
|
|
64
|
+
templates: ServerWorldNotificationTemplateConfig[];
|
|
65
|
+
}
|
|
52
66
|
export interface ResolvedServerConfig {
|
|
53
67
|
entry: string;
|
|
54
68
|
tickRate: number;
|
|
55
69
|
maxPlayers: number;
|
|
56
70
|
voiceEnabled: boolean;
|
|
57
71
|
destinations?: ServerDestinationConfig[];
|
|
72
|
+
worldNotifications?: ServerWorldNotificationsConfig;
|
|
58
73
|
}
|
|
59
74
|
export declare function resolveServerConfig(dir: string): ResolvedServerConfig | null;
|
|
60
75
|
export declare function deckStarterScene(dir: string): string;
|
package/dist/castleJson.js
CHANGED
|
@@ -48,14 +48,19 @@ export function resolveServerConfig(dir) {
|
|
|
48
48
|
DEFAULT_SERVER_ENTRIES.find((candidate) => fs.existsSync(path.join(dir, candidate)));
|
|
49
49
|
if (!entry || !isSafeServerEntry(dir, entry))
|
|
50
50
|
return null;
|
|
51
|
+
const destinations = server?.destinations === undefined
|
|
52
|
+
? undefined
|
|
53
|
+
: validateServerDestinations(server.destinations);
|
|
54
|
+
const worldNotifications = server?.worldNotifications === undefined
|
|
55
|
+
? undefined
|
|
56
|
+
: validateServerWorldNotifications(server.worldNotifications, destinations);
|
|
51
57
|
return {
|
|
52
58
|
entry,
|
|
53
59
|
tickRate: clampNumber(server?.tickRate, DEFAULT_SERVER_TICK_RATE, 0, SERVER_TICK_RATE_CAP),
|
|
54
60
|
maxPlayers: Math.floor(clampNumber(server?.maxPlayers, DEFAULT_SERVER_MAX_PLAYERS, 1, SERVER_MAX_PLAYERS_CAP)),
|
|
55
61
|
voiceEnabled: castleJson?.voice?.enabled !== false,
|
|
56
|
-
...(
|
|
57
|
-
|
|
58
|
-
: { destinations: validateServerDestinations(server.destinations) }),
|
|
62
|
+
...(destinations === undefined ? {} : { destinations }),
|
|
63
|
+
...(worldNotifications === undefined ? {} : { worldNotifications }),
|
|
59
64
|
};
|
|
60
65
|
}
|
|
61
66
|
function validateServerDestinations(value) {
|
|
@@ -68,6 +73,17 @@ function validateServerDestinations(value) {
|
|
|
68
73
|
throw invalidDestination(index, 'must be an object');
|
|
69
74
|
}
|
|
70
75
|
const route = candidate;
|
|
76
|
+
if (Object.keys(route).some((key) => ![
|
|
77
|
+
'routeId',
|
|
78
|
+
'access',
|
|
79
|
+
'selection',
|
|
80
|
+
'persistence',
|
|
81
|
+
'maxPlayers',
|
|
82
|
+
'characters',
|
|
83
|
+
'worldTime',
|
|
84
|
+
].includes(key))) {
|
|
85
|
+
throw invalidDestination(index, 'contains an unknown field');
|
|
86
|
+
}
|
|
71
87
|
const routeId = route.routeId;
|
|
72
88
|
if (typeof routeId !== 'string' || !/^[A-Za-z0-9_-]{1,64}$/.test(routeId)) {
|
|
73
89
|
throw invalidDestination(index, 'routeId must match [A-Za-z0-9_-] and be 1 through 64 characters');
|
|
@@ -94,6 +110,20 @@ function validateServerDestinations(value) {
|
|
|
94
110
|
(route.persistence !== 'world' || route.selection !== 'exact')) {
|
|
95
111
|
throw invalidDestination(index, 'shared characters require selection "exact" and persistence "world"');
|
|
96
112
|
}
|
|
113
|
+
let worldTime;
|
|
114
|
+
if (route.worldTime !== undefined) {
|
|
115
|
+
if (route.persistence !== 'world') {
|
|
116
|
+
throw invalidDestination(index, 'worldTime is only valid on a persistent world route');
|
|
117
|
+
}
|
|
118
|
+
if (!route.worldTime ||
|
|
119
|
+
typeof route.worldTime !== 'object' ||
|
|
120
|
+
Array.isArray(route.worldTime) ||
|
|
121
|
+
Object.keys(route.worldTime).some((key) => key !== 'advance') ||
|
|
122
|
+
route.worldTime.advance !== 'wallClock') {
|
|
123
|
+
throw invalidDestination(index, 'worldTime.advance must be wallClock');
|
|
124
|
+
}
|
|
125
|
+
worldTime = { advance: 'wallClock' };
|
|
126
|
+
}
|
|
97
127
|
if (!Number.isInteger(route.maxPlayers) ||
|
|
98
128
|
route.maxPlayers < 1 ||
|
|
99
129
|
route.maxPlayers > SERVER_MAX_PLAYERS_CAP) {
|
|
@@ -105,10 +135,113 @@ function validateServerDestinations(value) {
|
|
|
105
135
|
selection: route.selection,
|
|
106
136
|
persistence: route.persistence,
|
|
107
137
|
...(route.characters === 'shared' ? { characters: 'shared' } : {}),
|
|
138
|
+
...(worldTime === undefined ? {} : { worldTime }),
|
|
108
139
|
maxPlayers: route.maxPlayers,
|
|
109
140
|
};
|
|
110
141
|
});
|
|
111
142
|
}
|
|
143
|
+
const SERVER_WORLD_NOTIFICATION_TEMPLATES_CAP = 16;
|
|
144
|
+
const SERVER_WORLD_NOTIFICATION_SLOTS_CAP = 4;
|
|
145
|
+
const SAFE_WORLD_NOTIFICATION_KEY = /^[A-Za-z0-9_-]+$/;
|
|
146
|
+
const WORLD_NOTIFICATION_PLACEHOLDER = /\{([A-Za-z0-9_-]+)\}/g;
|
|
147
|
+
const WORLD_NOTIFICATION_URL = /(?:https?:\/\/|www\.|\b[a-z0-9-]+\.(?:app|com|dev|gg|io|net|org|xyz)\b)/i;
|
|
148
|
+
function worldNotificationCharacters(value) {
|
|
149
|
+
return Array.from(value).length;
|
|
150
|
+
}
|
|
151
|
+
function isWorldNotificationSafeKey(value) {
|
|
152
|
+
return typeof value === 'string' &&
|
|
153
|
+
worldNotificationCharacters(value) >= 1 &&
|
|
154
|
+
worldNotificationCharacters(value) <= 64 &&
|
|
155
|
+
SAFE_WORLD_NOTIFICATION_KEY.test(value);
|
|
156
|
+
}
|
|
157
|
+
function validateServerWorldNotifications(value, destinations) {
|
|
158
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
159
|
+
throw invalidWorldNotifications('must be an object');
|
|
160
|
+
}
|
|
161
|
+
const config = value;
|
|
162
|
+
if (Object.keys(config).some((key) => key !== 'version' && key !== 'templates')) {
|
|
163
|
+
throw invalidWorldNotifications('contains an unsupported field');
|
|
164
|
+
}
|
|
165
|
+
if (config.version !== 1)
|
|
166
|
+
throw invalidWorldNotifications('version must be 1');
|
|
167
|
+
if (!Array.isArray(config.templates) ||
|
|
168
|
+
config.templates.length > SERVER_WORLD_NOTIFICATION_TEMPLATES_CAP) {
|
|
169
|
+
throw invalidWorldNotifications(`templates must be an array of at most ${SERVER_WORLD_NOTIFICATION_TEMPLATES_CAP} templates`);
|
|
170
|
+
}
|
|
171
|
+
if (!destinations?.some((route) => route.persistence === 'world')) {
|
|
172
|
+
throw invalidWorldNotifications('requires at least one persistent world destination');
|
|
173
|
+
}
|
|
174
|
+
const templateIds = new Set();
|
|
175
|
+
const templates = config.templates.map((candidate, index) => {
|
|
176
|
+
if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) {
|
|
177
|
+
throw invalidWorldNotificationTemplate(index, 'must be an object');
|
|
178
|
+
}
|
|
179
|
+
const template = candidate;
|
|
180
|
+
if (Object.keys(template).some((key) => key !== 'id' && key !== 'text' && key !== 'slots' && key !== 'timeSensitive')) {
|
|
181
|
+
throw invalidWorldNotificationTemplate(index, 'contains an unsupported field');
|
|
182
|
+
}
|
|
183
|
+
if (!isWorldNotificationSafeKey(template.id)) {
|
|
184
|
+
throw invalidWorldNotificationTemplate(index, 'id must be a safe key of at most 64 characters');
|
|
185
|
+
}
|
|
186
|
+
if (templateIds.has(template.id)) {
|
|
187
|
+
throw invalidWorldNotificationTemplate(index, `id "${template.id}" is duplicated`);
|
|
188
|
+
}
|
|
189
|
+
templateIds.add(template.id);
|
|
190
|
+
if (typeof template.text !== 'string' ||
|
|
191
|
+
worldNotificationCharacters(template.text) < 1 ||
|
|
192
|
+
worldNotificationCharacters(template.text) > 120 ||
|
|
193
|
+
template.text.includes('\n') ||
|
|
194
|
+
template.text.includes('\r') ||
|
|
195
|
+
WORLD_NOTIFICATION_URL.test(template.text)) {
|
|
196
|
+
throw invalidWorldNotificationTemplate(index, 'text must be 1 through 120 characters on one line and contain no URL');
|
|
197
|
+
}
|
|
198
|
+
if (!Array.isArray(template.slots) || template.slots.length > SERVER_WORLD_NOTIFICATION_SLOTS_CAP) {
|
|
199
|
+
throw invalidWorldNotificationTemplate(index, `slots must be an array of at most ${SERVER_WORLD_NOTIFICATION_SLOTS_CAP} safe keys`);
|
|
200
|
+
}
|
|
201
|
+
const slots = template.slots.map((slot, slotIndex) => {
|
|
202
|
+
if (!isWorldNotificationSafeKey(slot)) {
|
|
203
|
+
throw invalidWorldNotificationTemplate(index, `slots[${slotIndex}] must be a safe key`);
|
|
204
|
+
}
|
|
205
|
+
return slot;
|
|
206
|
+
});
|
|
207
|
+
if (new Set(slots).size !== slots.length) {
|
|
208
|
+
throw invalidWorldNotificationTemplate(index, 'slots must not contain duplicates');
|
|
209
|
+
}
|
|
210
|
+
if (slots.includes('actor')) {
|
|
211
|
+
throw invalidWorldNotificationTemplate(index, 'slots cannot declare the reserved name actor');
|
|
212
|
+
}
|
|
213
|
+
const placeholders = new Set();
|
|
214
|
+
for (const match of template.text.matchAll(WORLD_NOTIFICATION_PLACEHOLDER)) {
|
|
215
|
+
const placeholder = match[1];
|
|
216
|
+
placeholders.add(placeholder);
|
|
217
|
+
}
|
|
218
|
+
const textWithoutPlaceholders = template.text.replace(WORLD_NOTIFICATION_PLACEHOLDER, '');
|
|
219
|
+
if (textWithoutPlaceholders.includes('{') || textWithoutPlaceholders.includes('}')) {
|
|
220
|
+
throw invalidWorldNotificationTemplate(index, 'text contains an invalid placeholder');
|
|
221
|
+
}
|
|
222
|
+
for (const placeholder of placeholders) {
|
|
223
|
+
if (!slots.includes(placeholder)) {
|
|
224
|
+
throw invalidWorldNotificationTemplate(index, `placeholder "${placeholder}" must appear in slots`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (template.timeSensitive !== undefined && typeof template.timeSensitive !== 'boolean') {
|
|
228
|
+
throw invalidWorldNotificationTemplate(index, 'timeSensitive must be a boolean when present');
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
id: template.id,
|
|
232
|
+
text: template.text,
|
|
233
|
+
slots,
|
|
234
|
+
timeSensitive: template.timeSensitive === true,
|
|
235
|
+
};
|
|
236
|
+
});
|
|
237
|
+
return { version: 1, templates };
|
|
238
|
+
}
|
|
239
|
+
function invalidWorldNotifications(message) {
|
|
240
|
+
return new Error(`server.worldNotifications ${message}.`);
|
|
241
|
+
}
|
|
242
|
+
function invalidWorldNotificationTemplate(index, message) {
|
|
243
|
+
return new Error(`server.worldNotifications.templates[${index}] ${message}.`);
|
|
244
|
+
}
|
|
112
245
|
function invalidDestination(index, message) {
|
|
113
246
|
return new Error(`server.destinations[${index}] ${message}.`);
|
|
114
247
|
}
|
package/dist/cloudGit.d.ts
CHANGED
|
@@ -15,11 +15,17 @@ export declare const EXIT_CONFLICT = 3;
|
|
|
15
15
|
* the snapshot bundle could bring them back. Nothing was changed; the next command retries.
|
|
16
16
|
*/
|
|
17
17
|
export declare const EXIT_HISTORY_UNAVAILABLE = 4;
|
|
18
|
+
/**
|
|
19
|
+
* A first attach outran the caller's deadline and carries on in the background (see
|
|
20
|
+
* attachThroughChild). Not attached yet; the deck works without git until it is.
|
|
21
|
+
*/
|
|
22
|
+
export declare const EXIT_ATTACH_CONTINUING = 5;
|
|
18
23
|
export declare const HISTORY_UNAVAILABLE_CODE = "GIT_HISTORY_UNAVAILABLE";
|
|
19
24
|
export declare class CloudGitError extends Error {
|
|
20
25
|
readonly exitCode: number;
|
|
21
26
|
constructor(message: string, exitCode?: number);
|
|
22
27
|
}
|
|
28
|
+
export declare const CLOUD_LOCKFILES: string[];
|
|
23
29
|
export declare const CLOUD_EXCLUDES: string[];
|
|
24
30
|
export declare const LOOSE_OBJECT_LIMIT = 200;
|
|
25
31
|
export declare const STALE_GIT_LOCK_MS = 60000;
|
|
@@ -184,6 +190,8 @@ export interface MergeState {
|
|
|
184
190
|
mergeHead: string;
|
|
185
191
|
files: ConflictedFile[];
|
|
186
192
|
instruction: string;
|
|
193
|
+
/** Who authored the remote side, phrased for user-facing conflict copy. */
|
|
194
|
+
otherSide?: string;
|
|
187
195
|
/**
|
|
188
196
|
* Left by a rehydrate that gave up lost history mid-merge: no MERGE_HEAD any more, but the
|
|
189
197
|
* files still have markers, and the next commit must be a `--resolve`.
|
|
@@ -197,6 +205,8 @@ export interface ConflictReport {
|
|
|
197
205
|
theirs: string[];
|
|
198
206
|
ours: string[];
|
|
199
207
|
instruction: string;
|
|
208
|
+
otherSide?: string;
|
|
209
|
+
notice?: string;
|
|
200
210
|
}
|
|
201
211
|
export interface ConflictSummary {
|
|
202
212
|
files: Pick<ConflictedFile, 'path' | 'resolution'>[];
|
|
@@ -204,6 +214,8 @@ export interface ConflictSummary {
|
|
|
204
214
|
ours: string[];
|
|
205
215
|
/** This sandbox's commit when the merge started, where its version of every file is. */
|
|
206
216
|
head: string;
|
|
217
|
+
/** Defaults to the legacy generic wording for old callers and records. */
|
|
218
|
+
otherSide?: string;
|
|
207
219
|
}
|
|
208
220
|
export declare function conflictInstruction(summary: ConflictSummary): string;
|
|
209
221
|
export interface CommitOptions {
|
|
@@ -233,6 +245,16 @@ export declare const REHYDRATE_STATE_FILE: string;
|
|
|
233
245
|
export declare const REHYDRATE_LOG_FILE: string;
|
|
234
246
|
/** `off` stops commands from starting a background rehydrate (tests). */
|
|
235
247
|
export declare const BACKGROUND_REHYDRATE_ENV = "CASTLE_GIT_BACKGROUND_REHYDRATE";
|
|
248
|
+
/** A file each rehydrate appends one JSON outcome line to. The sandbox image points it at the
|
|
249
|
+
* container's own stdout (/proc/1/fd/1), which the host ships to Loki; the log file above does
|
|
250
|
+
* not leave the container. Unset: no event. */
|
|
251
|
+
export declare const CONTAINER_EVENT_LOG_ENV = "CASTLE_CONTAINER_EVENT_LOG";
|
|
252
|
+
/** Held by the child a first attach runs in, for its whole run (see attachThroughChild). */
|
|
253
|
+
export declare const ATTACH_LOCK_FILE: string;
|
|
254
|
+
/** Where that child writes its output. */
|
|
255
|
+
export declare const ATTACH_LOG_FILE: string;
|
|
256
|
+
/** `1` in that child: it attaches in its own process, bound by no caller's deadline. */
|
|
257
|
+
export declare const BACKGROUND_ATTACH_ENV = "CASTLE_GIT_BACKGROUND_ATTACH";
|
|
236
258
|
export declare const SNAPSHOT_CAP_BYTES: number;
|
|
237
259
|
/** A smaller cap, for tests. */
|
|
238
260
|
export declare const SNAPSHOT_CAP_ENV = "CASTLE_GIT_SNAPSHOT_CAP_BYTES";
|
|
@@ -339,8 +361,12 @@ export interface AttachOutcome {
|
|
|
339
361
|
/** For `adopted`: where the cloud copy's differing files were saved, if any differed. */
|
|
340
362
|
backup?: string;
|
|
341
363
|
}
|
|
364
|
+
/** A first attach a child ran to the end within the caller's deadline: the child's own output. */
|
|
365
|
+
export interface ChildAttachOutcome {
|
|
366
|
+
output: string;
|
|
367
|
+
}
|
|
342
368
|
/** `castle-web git attach <dir> --remote <url>`. */
|
|
343
|
-
export declare function cloudAttach(dir: string, remoteUrl: string, deps: CloudGitDeps): Promise<AttachOutcome>;
|
|
369
|
+
export declare function cloudAttach(dir: string, remoteUrl: string, deps: CloudGitDeps): Promise<AttachOutcome | ChildAttachOutcome>;
|
|
344
370
|
export type GitChangeKind = 'added' | 'changed' | 'deleted';
|
|
345
371
|
export interface GitVersionEntry {
|
|
346
372
|
id: string;
|