gipity 1.1.14 → 1.1.16
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/agents/opencode.js +13 -2
- package/dist/commands/build.js +14 -0
- package/dist/index.js +17 -5
- package/dist/relay/daemon.js +27 -6
- package/package.json +1 -1
package/dist/agents/opencode.js
CHANGED
|
@@ -46,7 +46,7 @@ export const opencodeAdapter = {
|
|
|
46
46
|
providerName: 'Anomaly',
|
|
47
47
|
binary: 'opencode',
|
|
48
48
|
buildInteractiveArgs({ resume, model }) {
|
|
49
|
-
const args = [];
|
|
49
|
+
const args = ['--dir', process.cwd()];
|
|
50
50
|
if (model)
|
|
51
51
|
args.push('--model', toOpencodeModel(model));
|
|
52
52
|
if (resume)
|
|
@@ -54,7 +54,18 @@ export const opencodeAdapter = {
|
|
|
54
54
|
return args;
|
|
55
55
|
},
|
|
56
56
|
buildHeadlessArgs({ message, resume, model, bypassApprovals, jsonStream }) {
|
|
57
|
-
|
|
57
|
+
// `--dir` is REQUIRED, not a nicety: opencode resolves its own working
|
|
58
|
+
// directory rather than inheriting the spawn cwd, and lands on $HOME when
|
|
59
|
+
// nothing tells it otherwise. On a cloud devbox that meant every file the
|
|
60
|
+
// agent wrote went to /home/relay instead of the project - so nothing
|
|
61
|
+
// synced back to Gipity and the user saw an agent that "didn't write any
|
|
62
|
+
// files" (observed live 2026-08-14: `← Write /home/relay/foo.txt` while
|
|
63
|
+
// the daemon's own sync ran in .../GipityProjects/project-394).
|
|
64
|
+
//
|
|
65
|
+
// process.cwd() is the right value: `gipity build` is spawned by the relay
|
|
66
|
+
// daemon with cwd set to the resolved project dir, and launches the agent
|
|
67
|
+
// from that same cwd.
|
|
68
|
+
const args = ['run', '--dir', process.cwd(), message];
|
|
58
69
|
if (model)
|
|
59
70
|
args.push('--model', toOpencodeModel(model));
|
|
60
71
|
if (resume)
|
package/dist/commands/build.js
CHANGED
|
@@ -1152,6 +1152,20 @@ async function launchNonClaudeAgent(adapter, ctx) {
|
|
|
1152
1152
|
const childEnv = { ...process.env };
|
|
1153
1153
|
if (convGuid)
|
|
1154
1154
|
childEnv.GIPITY_CONVERSATION_GUID = convGuid;
|
|
1155
|
+
// Pin project attribution for the agent's own model calls. opencode's
|
|
1156
|
+
// Gipity provider sends this as X-Gipity-Project so per-project cost
|
|
1157
|
+
// reporting sees the spend; without it every llm_agent ledger row lands
|
|
1158
|
+
// unattributed (project_id NULL), which is what happened to the first
|
|
1159
|
+
// cloud devbox sessions.
|
|
1160
|
+
//
|
|
1161
|
+
// The plugin's fallback is to read .gipity.json from the directory OPENCODE
|
|
1162
|
+
// reports, which is not reliably the linked project dir - the plugin has
|
|
1163
|
+
// always documented that a runner which knows the project should pin it
|
|
1164
|
+
// here, but nothing ever did. We do know it: this is the launch that just
|
|
1165
|
+
// resolved the config.
|
|
1166
|
+
const projectGuidForAgent = getConfig()?.projectGuid;
|
|
1167
|
+
if (projectGuidForAgent)
|
|
1168
|
+
childEnv.GIPITY_PROJECT = projectGuidForAgent;
|
|
1155
1169
|
const agentCmd = resolveCommand(adapter.binary);
|
|
1156
1170
|
const child = spawnCommand(agentCmd, agentArgs, {
|
|
1157
1171
|
stdio: 'inherit',
|
package/dist/index.js
CHANGED
|
@@ -8863,13 +8863,13 @@ var init_opencode2 = __esm({
|
|
|
8863
8863
|
providerName: "Anomaly",
|
|
8864
8864
|
binary: "opencode",
|
|
8865
8865
|
buildInteractiveArgs({ resume, model }) {
|
|
8866
|
-
const args = [];
|
|
8866
|
+
const args = ["--dir", process.cwd()];
|
|
8867
8867
|
if (model) args.push("--model", toOpencodeModel(model));
|
|
8868
8868
|
if (resume) args.push("--session", resume);
|
|
8869
8869
|
return args;
|
|
8870
8870
|
},
|
|
8871
8871
|
buildHeadlessArgs({ message, resume, model, bypassApprovals, jsonStream }) {
|
|
8872
|
-
const args = ["run", message];
|
|
8872
|
+
const args = ["run", "--dir", process.cwd(), message];
|
|
8873
8873
|
if (model) args.push("--model", toOpencodeModel(model));
|
|
8874
8874
|
if (resume) args.push("--session", resume);
|
|
8875
8875
|
if (bypassApprovals) args.push("--auto");
|
|
@@ -41965,6 +41965,8 @@ Sending to ${adapter.displayName}: ${message}
|
|
|
41965
41965
|
}
|
|
41966
41966
|
const childEnv2 = { ...process.env };
|
|
41967
41967
|
if (convGuid) childEnv2.GIPITY_CONVERSATION_GUID = convGuid;
|
|
41968
|
+
const projectGuidForAgent = getConfig()?.projectGuid;
|
|
41969
|
+
if (projectGuidForAgent) childEnv2.GIPITY_PROJECT = projectGuidForAgent;
|
|
41968
41970
|
const agentCmd = resolveCommand(adapter.binary);
|
|
41969
41971
|
const child = spawnCommand(agentCmd, agentArgs, {
|
|
41970
41972
|
stdio: "inherit",
|
|
@@ -47918,6 +47920,7 @@ async function handleDispatch(claimed) {
|
|
|
47918
47920
|
let killed = false;
|
|
47919
47921
|
let runtimeLimit = false;
|
|
47920
47922
|
let stderrTail = "";
|
|
47923
|
+
let assistantTail = "";
|
|
47921
47924
|
let startupMs;
|
|
47922
47925
|
try {
|
|
47923
47926
|
const result = await spawnGipityClaude(args, cwd, d, queue, { resumeWords: transcript?.words });
|
|
@@ -47925,6 +47928,7 @@ async function handleDispatch(claimed) {
|
|
|
47925
47928
|
killed = result.killed;
|
|
47926
47929
|
runtimeLimit = result.runtimeLimit ?? false;
|
|
47927
47930
|
stderrTail = result.stderrTail ?? "";
|
|
47931
|
+
assistantTail = result.assistantTail ?? "";
|
|
47928
47932
|
startupMs = result.startupMs;
|
|
47929
47933
|
} catch (err) {
|
|
47930
47934
|
spawnErr = err?.message || String(err);
|
|
@@ -47940,7 +47944,7 @@ async function handleDispatch(claimed) {
|
|
|
47940
47944
|
}
|
|
47941
47945
|
}
|
|
47942
47946
|
const stderrNote = stderrTail ? `: ${stderrTail.slice(0, 300)}` : "";
|
|
47943
|
-
const authHint = exitCode !== 0 && !killed && !runtimeLimit && !spawnErr ? claudeAuthFailureHint(await claudeAuthStatusAsync(), stderrTail
|
|
47947
|
+
const authHint = exitCode !== 0 && !killed && !runtimeLimit && !spawnErr ? claudeAuthFailureHint(await claudeAuthStatusAsync(), `${stderrTail} ${assistantTail}`, getDevice()?.name) : null;
|
|
47944
47948
|
const authNote = authHint ? ` \xB7 ${authHint}` : "";
|
|
47945
47949
|
const tail2 = runtimeLimit ? `stopped after ${dur} (runtime limit)` : killed ? `cancelled (${dur})` : spawnErr ? `failed (${dur}: ${spawnErr})` : exitCode === 0 ? `finished (${dur})` : `failed (${dur}, exit ${exitCode}${stderrNote})${authNote}`;
|
|
47946
47950
|
pushSystem(`Claude Code ${tail2}`);
|
|
@@ -47963,9 +47967,9 @@ async function handleDispatch(claimed) {
|
|
|
47963
47967
|
}
|
|
47964
47968
|
}
|
|
47965
47969
|
var CLAUDE_AUTH_ERROR_RE = /not logged in|please run \/login|claude auth login|invalid api key|authentication_error|oauth token (?:has )?(?:expired|been revoked)/i;
|
|
47966
|
-
function claudeAuthFailureHint(status,
|
|
47970
|
+
function claudeAuthFailureHint(status, outputTail, deviceName) {
|
|
47967
47971
|
if (status?.loggedIn === false) return claudeLoginHint(deviceName);
|
|
47968
|
-
if (status === null && CLAUDE_AUTH_ERROR_RE.test(
|
|
47972
|
+
if (status === null && CLAUDE_AUTH_ERROR_RE.test(outputTail)) return claudeLoginHint(deviceName);
|
|
47969
47973
|
return null;
|
|
47970
47974
|
}
|
|
47971
47975
|
async function handleNonClaudeDispatch(adapter, d, cwd, queue, pushSystem, flushQueue) {
|
|
@@ -48379,6 +48383,7 @@ async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
48379
48383
|
const ownQueue = !queue;
|
|
48380
48384
|
const dispatchStartedAt = Date.now();
|
|
48381
48385
|
let stdoutBytesTotal = 0;
|
|
48386
|
+
const assistantTail = [];
|
|
48382
48387
|
let lastStdoutByteAt = dispatchStartedAt;
|
|
48383
48388
|
let stdoutBytesAtLastTick = 0;
|
|
48384
48389
|
const phases = new PhaseTracker();
|
|
@@ -48488,6 +48493,12 @@ async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
48488
48493
|
e.ts = ts2;
|
|
48489
48494
|
if (!e.source_uuid) e.source_uuid = randomUUID2();
|
|
48490
48495
|
}
|
|
48496
|
+
for (const e of entries) {
|
|
48497
|
+
if (e.kind === "assistant" && typeof e.text === "string") {
|
|
48498
|
+
assistantTail.push(e.text.trim());
|
|
48499
|
+
if (assistantTail.length > 3) assistantTail.shift();
|
|
48500
|
+
}
|
|
48501
|
+
}
|
|
48491
48502
|
q.push(...entries);
|
|
48492
48503
|
});
|
|
48493
48504
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -48542,6 +48553,7 @@ async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
48542
48553
|
killed,
|
|
48543
48554
|
runtimeLimit,
|
|
48544
48555
|
stderrTail: stderrTail.join(" | "),
|
|
48556
|
+
assistantTail: assistantTail.join(" | "),
|
|
48545
48557
|
startupMs: firstEventAt !== void 0 ? Math.max(0, firstEventAt - dispatchStartedAt) : void 0
|
|
48546
48558
|
});
|
|
48547
48559
|
});
|
package/dist/relay/daemon.js
CHANGED
|
@@ -1123,6 +1123,7 @@ async function handleDispatch(claimed) {
|
|
|
1123
1123
|
let killed = false;
|
|
1124
1124
|
let runtimeLimit = false;
|
|
1125
1125
|
let stderrTail = '';
|
|
1126
|
+
let assistantTail = '';
|
|
1126
1127
|
let startupMs;
|
|
1127
1128
|
try {
|
|
1128
1129
|
const result = await spawnGipityClaude(args, cwd, d, queue, { resumeWords: transcript?.words });
|
|
@@ -1130,6 +1131,7 @@ async function handleDispatch(claimed) {
|
|
|
1130
1131
|
killed = result.killed;
|
|
1131
1132
|
runtimeLimit = result.runtimeLimit ?? false;
|
|
1132
1133
|
stderrTail = result.stderrTail ?? '';
|
|
1134
|
+
assistantTail = result.assistantTail ?? '';
|
|
1133
1135
|
startupMs = result.startupMs;
|
|
1134
1136
|
}
|
|
1135
1137
|
catch (err) {
|
|
@@ -1175,7 +1177,7 @@ async function handleDispatch(claimed) {
|
|
|
1175
1177
|
// guess would trade one misleading message for another. Only computed on the
|
|
1176
1178
|
// failure path - the check spawns a process.
|
|
1177
1179
|
const authHint = (exitCode !== 0 && !killed && !runtimeLimit && !spawnErr)
|
|
1178
|
-
? claudeAuthFailureHint(await claudeAuthStatusAsync(), stderrTail
|
|
1180
|
+
? claudeAuthFailureHint(await claudeAuthStatusAsync(), `${stderrTail} ${assistantTail}`, state.getDevice()?.name)
|
|
1179
1181
|
: null;
|
|
1180
1182
|
const authNote = authHint ? ` · ${authHint}` : '';
|
|
1181
1183
|
const tail = runtimeLimit
|
|
@@ -1214,7 +1216,7 @@ async function handleDispatch(claimed) {
|
|
|
1214
1216
|
await ack(d.short_guid, 'error', `Claude Code exited with code ${exitCode}${stderrNote}${authNote}`);
|
|
1215
1217
|
}
|
|
1216
1218
|
}
|
|
1217
|
-
/**
|
|
1219
|
+
/** Output shapes that mean "Claude Code could not authenticate". Only consulted
|
|
1218
1220
|
* when `claude auth status` couldn't answer, so it never has to be exhaustive. */
|
|
1219
1221
|
const CLAUDE_AUTH_ERROR_RE = /not logged in|please run \/login|claude auth login|invalid api key|authentication_error|oauth token (?:has )?(?:expired|been revoked)/i;
|
|
1220
1222
|
/**
|
|
@@ -1225,16 +1227,19 @@ const CLAUDE_AUTH_ERROR_RE = /not logged in|please run \/login|claude auth login
|
|
|
1225
1227
|
* Conservative by construction:
|
|
1226
1228
|
* - `loggedIn: false` is definitive, so translate.
|
|
1227
1229
|
* - status null (couldn't tell: Claude Code absent, or too old for `auth
|
|
1228
|
-
* status`) falls back to the child's
|
|
1229
|
-
* would otherwise not have given.
|
|
1230
|
+
* status`) falls back to the child's OUTPUT tail, which can only ADD a
|
|
1231
|
+
* hint we would otherwise not have given. That tail must include stdout,
|
|
1232
|
+
* not just stderr: Claude Code prints "Not logged in · Please run /login"
|
|
1233
|
+
* as assistant text on stdout, so a stderr-only haystack misses the only
|
|
1234
|
+
* line that names the failure.
|
|
1230
1235
|
* - `loggedIn: true` never translates, so a user prompt that merely contains
|
|
1231
1236
|
* the words "not logged in" cannot manufacture a bogus login hint.
|
|
1232
1237
|
* Exported for tests.
|
|
1233
1238
|
*/
|
|
1234
|
-
export function claudeAuthFailureHint(status,
|
|
1239
|
+
export function claudeAuthFailureHint(status, outputTail, deviceName) {
|
|
1235
1240
|
if (status?.loggedIn === false)
|
|
1236
1241
|
return claudeLoginHint(deviceName);
|
|
1237
|
-
if (status === null && CLAUDE_AUTH_ERROR_RE.test(
|
|
1242
|
+
if (status === null && CLAUDE_AUTH_ERROR_RE.test(outputTail))
|
|
1238
1243
|
return claudeLoginHint(deviceName);
|
|
1239
1244
|
return null;
|
|
1240
1245
|
}
|
|
@@ -1810,6 +1815,8 @@ export async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
1810
1815
|
// payload works for a future codex/aider/etc. runner.
|
|
1811
1816
|
const dispatchStartedAt = Date.now();
|
|
1812
1817
|
let stdoutBytesTotal = 0;
|
|
1818
|
+
// Last few assistant texts, for the auth-failure hint (see the push site).
|
|
1819
|
+
const assistantTail = [];
|
|
1813
1820
|
let lastStdoutByteAt = dispatchStartedAt;
|
|
1814
1821
|
let stdoutBytesAtLastTick = 0;
|
|
1815
1822
|
const phases = new PhaseTracker();
|
|
@@ -1980,6 +1987,19 @@ export async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
1980
1987
|
if (!e.source_uuid)
|
|
1981
1988
|
e.source_uuid = randomUUID();
|
|
1982
1989
|
}
|
|
1990
|
+
// Keep a small tail of assistant TEXT for the auth-failure hint. Claude
|
|
1991
|
+
// Code reports "Not logged in · Please run /login" as assistant output
|
|
1992
|
+
// on stdout, not on stderr - so a hint that only reads stderrTail can
|
|
1993
|
+
// never see the one line that names the problem (observed live on a
|
|
1994
|
+
// paired device 2026-08-14: the conversation showed the login message
|
|
1995
|
+
// while the failure marker showed only the wrapper's chatter).
|
|
1996
|
+
for (const e of entries) {
|
|
1997
|
+
if (e.kind === 'assistant' && typeof e.text === 'string') {
|
|
1998
|
+
assistantTail.push(e.text.trim());
|
|
1999
|
+
if (assistantTail.length > 3)
|
|
2000
|
+
assistantTail.shift();
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
1983
2003
|
q.push(...entries);
|
|
1984
2004
|
});
|
|
1985
2005
|
child.stdout?.on('data', (chunk) => {
|
|
@@ -2058,6 +2078,7 @@ export async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
2058
2078
|
cleanup();
|
|
2059
2079
|
resolve({
|
|
2060
2080
|
exitCode: code ?? 1, killed, runtimeLimit, stderrTail: stderrTail.join(' | '),
|
|
2081
|
+
assistantTail: assistantTail.join(' | '),
|
|
2061
2082
|
startupMs: firstEventAt !== undefined ? Math.max(0, firstEventAt - dispatchStartedAt) : undefined,
|
|
2062
2083
|
});
|
|
2063
2084
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
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",
|