gipity 1.1.32 → 1.1.33
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/commands/brand.js +13 -1
- package/dist/hooks/capture-runner.js +37 -2
- package/dist/index.js +6 -0
- package/package.json +1 -1
package/dist/commands/brand.js
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { Command } from 'commander';
|
|
14
14
|
import { get, post } from '../api.js';
|
|
15
|
-
import { resolveProjectContext } from '../config.js';
|
|
15
|
+
import { resolveProjectContext, getConfigPath } from '../config.js';
|
|
16
|
+
import { sync } from '../sync.js';
|
|
17
|
+
import { createProgressReporter } from '../progress.js';
|
|
16
18
|
import { bold, muted, success } from '../colors.js';
|
|
17
19
|
import { run } from '../helpers/index.js';
|
|
18
20
|
const ACCENT_SOURCE_LABEL = {
|
|
@@ -92,6 +94,7 @@ brandCommand
|
|
|
92
94
|
return;
|
|
93
95
|
}
|
|
94
96
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
97
|
+
await pullWrittenFiles(res.data.files ?? [], opts);
|
|
95
98
|
if (opts.json) {
|
|
96
99
|
console.log(JSON.stringify(res.data));
|
|
97
100
|
return;
|
|
@@ -109,12 +112,21 @@ brandCommand
|
|
|
109
112
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
110
113
|
const body = opts.fixHead ? { fix_head: true } : {};
|
|
111
114
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
115
|
+
await pullWrittenFiles(res.data.files ?? [], opts);
|
|
112
116
|
if (opts.json) {
|
|
113
117
|
console.log(JSON.stringify(res.data));
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
116
120
|
reportFiles(res.data.files ?? []);
|
|
117
121
|
}));
|
|
122
|
+
/** The server writes the regenerated assets (icons, manifest, index.html head)
|
|
123
|
+
* into the project. Pull them now: a local copy left stale gets edited, and
|
|
124
|
+
* the next deploy stops on a sync conflict. Only for the linked project in cwd. */
|
|
125
|
+
async function pullWrittenFiles(files, opts) {
|
|
126
|
+
if (!files.length || opts.project || !getConfigPath())
|
|
127
|
+
return;
|
|
128
|
+
await sync({ interactive: false, progress: opts.json ? undefined : createProgressReporter() });
|
|
129
|
+
}
|
|
118
130
|
function reportFiles(files) {
|
|
119
131
|
if (!files.length) {
|
|
120
132
|
console.log(muted('\nStored (assets not regenerated - run gipity brand apply).'));
|
|
@@ -317,9 +317,44 @@ async function readStdin() {
|
|
|
317
317
|
process.stdin.on('error', () => resolve(buf));
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
// Per-entry byte caps the ingest route enforces (platform routes/remote-sessions.ts),
|
|
321
|
+
// kept a little under. An entry over them 400s its whole batch, and since the
|
|
322
|
+
// watermark only advances on success, every later flush of the session failed
|
|
323
|
+
// on the same entry: one big screenshot stopped capture for the rest of the run.
|
|
324
|
+
const MAX_TOOL_JSON_BYTES = 190_000;
|
|
325
|
+
const MAX_ASSISTANT_CHARS = 480_000;
|
|
326
|
+
const bytesOf = (v) => {
|
|
327
|
+
try {
|
|
328
|
+
return Buffer.byteLength(JSON.stringify(v ?? null), 'utf-8');
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
return Infinity;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
/** Swap a payload the server would reject for a short note saying what was
|
|
335
|
+
* dropped, so the rest of the transcript still lands. Exported for tests. */
|
|
336
|
+
export function fitEntryToCaps(e) {
|
|
337
|
+
const note = (n) => `[omitted from the capture: ${Math.round(n / 1024)} KB, over the size cap]`;
|
|
338
|
+
if (e.kind === 'tool_result') {
|
|
339
|
+
const n = bytesOf(e.content);
|
|
340
|
+
return n > MAX_TOOL_JSON_BYTES ? { ...e, content: note(n) } : e;
|
|
341
|
+
}
|
|
342
|
+
if (e.kind === 'tool_use') {
|
|
343
|
+
const n = bytesOf(e.tool_input);
|
|
344
|
+
return n > MAX_TOOL_JSON_BYTES ? { ...e, tool_input: { omitted: note(n) } } : e;
|
|
345
|
+
}
|
|
346
|
+
if (e.kind === 'assistant') {
|
|
347
|
+
const n = bytesOf(e.blocks);
|
|
348
|
+
if (e.text.length <= MAX_ASSISTANT_CHARS && n <= MAX_ASSISTANT_CHARS)
|
|
349
|
+
return e;
|
|
350
|
+
return { ...e, text: e.text.slice(0, MAX_ASSISTANT_CHARS), blocks: [{ type: 'text', text: note(n) }] };
|
|
351
|
+
}
|
|
352
|
+
return e;
|
|
353
|
+
}
|
|
354
|
+
async function postEntries(convGuid, rawEntries) {
|
|
355
|
+
if (!rawEntries.length)
|
|
322
356
|
return true;
|
|
357
|
+
const entries = rawEntries.map(fitEntryToCaps);
|
|
323
358
|
// Batch into server-cap-safe chunks.
|
|
324
359
|
for (let i = 0; i < entries.length; i += INGEST_BATCH_MAX) {
|
|
325
360
|
const slice = entries.slice(i, i + INGEST_BATCH_MAX);
|
package/dist/index.js
CHANGED
|
@@ -42976,6 +42976,7 @@ brandCommand.command("set").description("Change brand fields and regenerate all
|
|
|
42976
42976
|
return;
|
|
42977
42977
|
}
|
|
42978
42978
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
42979
|
+
await pullWrittenFiles(res.data.files ?? [], opts);
|
|
42979
42980
|
if (opts.json) {
|
|
42980
42981
|
console.log(JSON.stringify(res.data));
|
|
42981
42982
|
return;
|
|
@@ -42987,12 +42988,17 @@ brandCommand.command("apply").description("Re-render all brand assets from the s
|
|
|
42987
42988
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
42988
42989
|
const body = opts.fixHead ? { fix_head: true } : {};
|
|
42989
42990
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
42991
|
+
await pullWrittenFiles(res.data.files ?? [], opts);
|
|
42990
42992
|
if (opts.json) {
|
|
42991
42993
|
console.log(JSON.stringify(res.data));
|
|
42992
42994
|
return;
|
|
42993
42995
|
}
|
|
42994
42996
|
reportFiles(res.data.files ?? []);
|
|
42995
42997
|
}));
|
|
42998
|
+
async function pullWrittenFiles(files, opts) {
|
|
42999
|
+
if (!files.length || opts.project || !getConfigPath()) return;
|
|
43000
|
+
await sync({ interactive: false, progress: opts.json ? void 0 : createProgressReporter() });
|
|
43001
|
+
}
|
|
42996
43002
|
function reportFiles(files) {
|
|
42997
43003
|
if (!files.length) {
|
|
42998
43004
|
console.log(muted("\nStored (assets not regenerated - run gipity brand apply)."));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.33",
|
|
4
4
|
"description": "The full-stack platform tuned for AI agents. Database, storage, auth, functions, deploy, and drop-in kits - all agent-tuned. Pair with Claude Code or use standalone.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gipity": "dist/updater/shim.js",
|