@yagni-app/code-staging 0.3.0-staging.1080.1 → 0.3.0-staging.1081.1
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/extension/config.d.ts +12 -0
- package/dist/extension/config.js +29 -1
- package/package.json +2 -2
|
@@ -175,11 +175,23 @@ export declare function isDriverCaller(env?: NodeJS.ProcessEnv): boolean;
|
|
|
175
175
|
* sanitizing client-side is what keeps the attribution instead of losing it.
|
|
176
176
|
*/
|
|
177
177
|
export declare function sanitizeCallerSegment(name: string, maxLength?: number): string;
|
|
178
|
+
/**
|
|
179
|
+
* Attribution headers for the boot-time /context fetch. Extends
|
|
180
|
+
* {@link attributionHeaders} (session id + caller) with the surface the
|
|
181
|
+
* session is painting for (the desktop driver sets YAGNI_SURFACE=desktop;
|
|
182
|
+
* the terminal CLI sets nothing) and the shipping client version. The server
|
|
183
|
+
* uses these to emit its "YAGNI Code Session Started" analytics event —
|
|
184
|
+
* labels only on that side: a missing or malformed value can never fail the
|
|
185
|
+
* fetch, it just goes uncounted or unversioned.
|
|
186
|
+
*/
|
|
187
|
+
export declare function sessionTelemetryHeaders(env?: NodeJS.ProcessEnv): Record<string, string>;
|
|
178
188
|
/** Options for {@link fetchContextBrief}. */
|
|
179
189
|
export interface FetchContextBriefOptions {
|
|
180
190
|
baseUrl: string;
|
|
181
191
|
getToken: () => string | undefined;
|
|
182
192
|
fetchImpl?: typeof fetch;
|
|
193
|
+
/** Env seam for the telemetry headers; defaults to process.env. */
|
|
194
|
+
env?: NodeJS.ProcessEnv;
|
|
183
195
|
}
|
|
184
196
|
/**
|
|
185
197
|
* Fetch the workspace company brief at startup.
|
package/dist/extension/config.js
CHANGED
|
@@ -177,6 +177,28 @@ export function sanitizeCallerSegment(name, maxLength = 64) {
|
|
|
177
177
|
const trimmed = cleaned.slice(0, Math.max(0, maxLength));
|
|
178
178
|
return trimmed || "agent";
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Shape-check for a client version label (semver-ish; matches the server's
|
|
182
|
+
* own allowlist). A value that fails is dropped, never sent raw.
|
|
183
|
+
*/
|
|
184
|
+
const CLIENT_VERSION_RE = /^[0-9a-z][0-9a-z.+-]{0,31}$/i;
|
|
185
|
+
/**
|
|
186
|
+
* Attribution headers for the boot-time /context fetch. Extends
|
|
187
|
+
* {@link attributionHeaders} (session id + caller) with the surface the
|
|
188
|
+
* session is painting for (the desktop driver sets YAGNI_SURFACE=desktop;
|
|
189
|
+
* the terminal CLI sets nothing) and the shipping client version. The server
|
|
190
|
+
* uses these to emit its "YAGNI Code Session Started" analytics event —
|
|
191
|
+
* labels only on that side: a missing or malformed value can never fail the
|
|
192
|
+
* fetch, it just goes uncounted or unversioned.
|
|
193
|
+
*/
|
|
194
|
+
export function sessionTelemetryHeaders(env = process.env) {
|
|
195
|
+
const headers = attributionHeaders(env);
|
|
196
|
+
headers["x-yagni-surface"] = env.YAGNI_SURFACE === "desktop" ? "desktop" : "cli";
|
|
197
|
+
const version = env.YAGNI_CODE_VERSION ?? "";
|
|
198
|
+
if (CLIENT_VERSION_RE.test(version))
|
|
199
|
+
headers["x-yagni-client-version"] = version;
|
|
200
|
+
return headers;
|
|
201
|
+
}
|
|
180
202
|
/**
|
|
181
203
|
* Fetch the workspace company brief at startup.
|
|
182
204
|
*
|
|
@@ -186,7 +208,13 @@ export function sanitizeCallerSegment(name, maxLength = 64) {
|
|
|
186
208
|
*/
|
|
187
209
|
export async function fetchContextBrief(opts) {
|
|
188
210
|
try {
|
|
189
|
-
const res = await resilientFetch(`${opts.baseUrl}/api/yagni-code/context`, {
|
|
211
|
+
const res = await resilientFetch(`${opts.baseUrl}/api/yagni-code/context`, {
|
|
212
|
+
method: "GET",
|
|
213
|
+
headers: {
|
|
214
|
+
authorization: `Bearer ${opts.getToken() ?? ""}`,
|
|
215
|
+
...sessionTelemetryHeaders(opts.env),
|
|
216
|
+
},
|
|
217
|
+
}, { fetchImpl: opts.fetchImpl });
|
|
190
218
|
if (!res.ok)
|
|
191
219
|
return null;
|
|
192
220
|
return (await res.json());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yagni-app/code-staging",
|
|
3
|
-
"version": "0.3.0-staging.
|
|
3
|
+
"version": "0.3.0-staging.1081.1",
|
|
4
4
|
"description": "YAGNI Code: a terminal coding agent that already knows your company. One YAGNI login routes the model and grounds the agent in your team's context.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "YAGNI, Inc. <jack@yagni.app> (https://yagni.app)",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"@earendil-works/pi-tui": "0.84.1",
|
|
39
39
|
"typebox": "^1.3.11"
|
|
40
40
|
},
|
|
41
|
-
"yagniSourceSha": "
|
|
41
|
+
"yagniSourceSha": "dd068fdb7b8bcb1207ff4f2fe803bf26b2e3eec3"
|
|
42
42
|
}
|