@uselemma/opencode 0.2.0 → 0.2.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/package.json +4 -4
- package/runtime/lemma.mjs +39 -83
- package/scripts/setup.mjs +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uselemma/opencode",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Lemma SDK tracing for OpenCode coding-agent sessions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lemma",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"tracing"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@opencode-ai/plugin": "1.18.19"
|
|
42
|
-
"@uselemma/tracing": "^7.15.0"
|
|
41
|
+
"@opencode-ai/plugin": "1.18.19"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@opencode-ai/sdk": "1.18.19",
|
|
46
45
|
"@types/node": "^22.18.8",
|
|
47
46
|
"esbuild": "^0.25.11",
|
|
48
47
|
"typescript": "^5.9.3",
|
|
49
|
-
"vitest": "^3.2.4"
|
|
48
|
+
"vitest": "^3.2.4",
|
|
49
|
+
"@uselemma/tracing": "^7.15.1"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "node build.mjs",
|
package/runtime/lemma.mjs
CHANGED
|
@@ -38,9 +38,8 @@ var require_debug_delivery = __commonJS({
|
|
|
38
38
|
"../../packages/ts/tracing/dist/debug-delivery.js"(exports) {
|
|
39
39
|
"use strict";
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.parseIngestStatus = parseIngestStatus;
|
|
41
|
+
exports.EXPECTED_INGEST_SUCCESS_STATUS = exports.INGEST_PATH = exports.PRODUCTION_BASE_URL = void 0;
|
|
42
|
+
exports.smokeTestConfirmHint = smokeTestConfirmHint;
|
|
44
43
|
exports.isValidProjectId = isValidProjectId;
|
|
45
44
|
exports.apiKeySuffix = apiKeySuffix;
|
|
46
45
|
exports.buildConfigWarnings = buildConfigWarnings;
|
|
@@ -48,23 +47,9 @@ var require_debug_delivery = __commonJS({
|
|
|
48
47
|
exports.pickResponseHeadersFromRecord = pickResponseHeadersFromRecord;
|
|
49
48
|
exports.PRODUCTION_BASE_URL = "https://api.uselemma.ai";
|
|
50
49
|
exports.INGEST_PATH = "/traces/ingest";
|
|
51
|
-
exports.INGEST_STATUS_PATH = "/traces/ingest-status";
|
|
52
50
|
exports.EXPECTED_INGEST_SUCCESS_STATUS = 201;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var SUCCESS_INGEST_STATUSES = /* @__PURE__ */ new Set([
|
|
56
|
-
"enqueued",
|
|
57
|
-
"ingested",
|
|
58
|
-
"ready"
|
|
59
|
-
]);
|
|
60
|
-
function isSuccessfulIngestStatus(status) {
|
|
61
|
-
return status != null && SUCCESS_INGEST_STATUSES.has(status);
|
|
62
|
-
}
|
|
63
|
-
function parseIngestStatus(value) {
|
|
64
|
-
if (value === "enqueued" || value === "ingested" || value === "ready" || value === "not_found") {
|
|
65
|
-
return value;
|
|
66
|
-
}
|
|
67
|
-
return null;
|
|
51
|
+
function smokeTestConfirmHint(traceId) {
|
|
52
|
+
return `ingest returned 201; confirm it arrived on your project's Traces page in the Lemma dashboard (trace lemma-debug-smoke-test, ID ${traceId})`;
|
|
68
53
|
}
|
|
69
54
|
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
70
55
|
function isValidProjectId(projectId) {
|
|
@@ -128,10 +113,13 @@ var require_debug_mode = __commonJS({
|
|
|
128
113
|
"../../packages/ts/tracing/dist/debug-mode.js"(exports) {
|
|
129
114
|
"use strict";
|
|
130
115
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
116
|
+
exports.DEBUG_VERIFY_REMOVED_MESSAGE = void 0;
|
|
131
117
|
exports.enableDebugMode = enableDebugMode;
|
|
132
118
|
exports.disableDebugMode = disableDebugMode;
|
|
133
119
|
exports.isDebugModeEnabled = isDebugModeEnabled;
|
|
134
120
|
exports.isDebugVerifyEnabled = isDebugVerifyEnabled;
|
|
121
|
+
exports.noteDebugVerifyRemovedOnce = noteDebugVerifyRemovedOnce;
|
|
122
|
+
exports.resetDebugVerifyNotice = resetDebugVerifyNotice;
|
|
135
123
|
exports.lemmaDebug = lemmaDebug;
|
|
136
124
|
var env_1 = require_env();
|
|
137
125
|
var debugModeEnabled = false;
|
|
@@ -150,6 +138,17 @@ var require_debug_mode = __commonJS({
|
|
|
150
138
|
function isDebugVerifyEnabled() {
|
|
151
139
|
return isFlagOn((0, env_1.readEnv)(() => process.env.LEMMA_DEBUG_VERIFY));
|
|
152
140
|
}
|
|
141
|
+
exports.DEBUG_VERIFY_REMOVED_MESSAGE = `arrival verification was removed, so LEMMA_DEBUG_VERIFY makes no request. A "trace sent" line with status 201 means Lemma ingest accepted the trace; confirm it on your project's Traces page in the Lemma dashboard.`;
|
|
142
|
+
var debugVerifyRemovedNoted = false;
|
|
143
|
+
function noteDebugVerifyRemovedOnce() {
|
|
144
|
+
if (debugVerifyRemovedNoted || !isDebugModeEnabled())
|
|
145
|
+
return;
|
|
146
|
+
debugVerifyRemovedNoted = true;
|
|
147
|
+
lemmaDebug("verify", exports.DEBUG_VERIFY_REMOVED_MESSAGE);
|
|
148
|
+
}
|
|
149
|
+
function resetDebugVerifyNotice() {
|
|
150
|
+
debugVerifyRemovedNoted = false;
|
|
151
|
+
}
|
|
153
152
|
function lemmaDebug(prefix, msg, data) {
|
|
154
153
|
if (!isDebugModeEnabled())
|
|
155
154
|
return;
|
|
@@ -963,7 +962,7 @@ var require_version = __commonJS({
|
|
|
963
962
|
"use strict";
|
|
964
963
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
965
964
|
exports.SDK_USER_AGENT = void 0;
|
|
966
|
-
exports.SDK_USER_AGENT = "@uselemma/tracing/7.15.
|
|
965
|
+
exports.SDK_USER_AGENT = "@uselemma/tracing/7.15.1";
|
|
967
966
|
}
|
|
968
967
|
});
|
|
969
968
|
|
|
@@ -1204,6 +1203,8 @@ var require_client = __commonJS({
|
|
|
1204
1203
|
/**
|
|
1205
1204
|
* Close this span as failed if it is still open. A no-op once ended, so a
|
|
1206
1205
|
* completed span is never rewritten. The end is never before the start.
|
|
1206
|
+
*
|
|
1207
|
+
* @internal
|
|
1207
1208
|
*/
|
|
1208
1209
|
failUnfinished(error, endedAt) {
|
|
1209
1210
|
if (this.ended)
|
|
@@ -1306,6 +1307,7 @@ var require_client = __commonJS({
|
|
|
1306
1307
|
id = "";
|
|
1307
1308
|
end() {
|
|
1308
1309
|
}
|
|
1310
|
+
/** @internal */
|
|
1309
1311
|
failUnfinished(_error, _endedAt) {
|
|
1310
1312
|
}
|
|
1311
1313
|
ensureEndedAt(_endedAt) {
|
|
@@ -1362,7 +1364,11 @@ var require_client = __commonJS({
|
|
|
1362
1364
|
this.rootOutput = { value };
|
|
1363
1365
|
this.changed();
|
|
1364
1366
|
}
|
|
1365
|
-
/**
|
|
1367
|
+
/**
|
|
1368
|
+
* Whether the root output was set through options or `output()`.
|
|
1369
|
+
*
|
|
1370
|
+
* @internal
|
|
1371
|
+
*/
|
|
1366
1372
|
get hasOutput() {
|
|
1367
1373
|
return this.rootOutput !== void 0;
|
|
1368
1374
|
}
|
|
@@ -1612,8 +1618,9 @@ var require_client = __commonJS({
|
|
|
1612
1618
|
this.logInitConfigOnce();
|
|
1613
1619
|
}
|
|
1614
1620
|
/**
|
|
1615
|
-
* Run a one-call delivery diagnostic: config check
|
|
1616
|
-
*
|
|
1621
|
+
* Run a one-call delivery diagnostic: config check and a minimal ingest.
|
|
1622
|
+
* `ok` means ingest returned 201 for the smoke trace; confirm it arrived
|
|
1623
|
+
* on the project's Traces page in the Lemma dashboard.
|
|
1617
1624
|
*/
|
|
1618
1625
|
async debugSmokeTest() {
|
|
1619
1626
|
const configWarnings = (0, debug_delivery_1.buildConfigWarnings)(this.baseUrl, this.projectId);
|
|
@@ -1677,17 +1684,13 @@ var require_client = __commonJS({
|
|
|
1677
1684
|
hints
|
|
1678
1685
|
};
|
|
1679
1686
|
}
|
|
1680
|
-
const
|
|
1681
|
-
if (
|
|
1682
|
-
hints.push(
|
|
1683
|
-
} else if (!(0, debug_delivery_1.isSuccessfulIngestStatus)(ingestStatus)) {
|
|
1684
|
-
hints.push(`ingest returned 201 but ingest-status=not_found after ${debug_delivery_1.INGEST_STATUS_POLL_TIMEOUT_MS / 1e3}s \u2014 may be processing lag or downstream issue`);
|
|
1685
|
-
}
|
|
1687
|
+
const ok = response.status === debug_delivery_1.EXPECTED_INGEST_SUCCESS_STATUS;
|
|
1688
|
+
if (ok)
|
|
1689
|
+
hints.push((0, debug_delivery_1.smokeTestConfirmHint)(traceId));
|
|
1686
1690
|
return {
|
|
1687
|
-
ok
|
|
1691
|
+
ok,
|
|
1688
1692
|
config,
|
|
1689
1693
|
ingest,
|
|
1690
|
-
ingestStatus: ingestStatus ?? void 0,
|
|
1691
1694
|
hints
|
|
1692
1695
|
};
|
|
1693
1696
|
}
|
|
@@ -1924,53 +1927,6 @@ var require_client = __commonJS({
|
|
|
1924
1927
|
...warnings.length ? { warnings } : {}
|
|
1925
1928
|
});
|
|
1926
1929
|
}
|
|
1927
|
-
async fetchIngestStatus(otelTraceId) {
|
|
1928
|
-
const url = `${this.baseUrl}${debug_delivery_1.INGEST_STATUS_PATH}?project_id=${encodeURIComponent(this.projectId)}&otel_trace_id=${encodeURIComponent(otelTraceId)}`;
|
|
1929
|
-
try {
|
|
1930
|
-
return await (0, delivery_1.withIngestTimeout)(async (signal) => {
|
|
1931
|
-
const response = await this.fetchImpl(url, {
|
|
1932
|
-
headers: { ...this.baseHeaders },
|
|
1933
|
-
signal
|
|
1934
|
-
});
|
|
1935
|
-
if (!response.ok)
|
|
1936
|
-
return null;
|
|
1937
|
-
const data = await response.json();
|
|
1938
|
-
return (0, debug_delivery_1.parseIngestStatus)(data.status);
|
|
1939
|
-
});
|
|
1940
|
-
} catch {
|
|
1941
|
-
return null;
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
/**
|
|
1945
|
-
* Poll ingest-status immediately, then every 1s until success, hard failure,
|
|
1946
|
-
* or the 15s timeout.
|
|
1947
|
-
*/
|
|
1948
|
-
async pollIngestStatus(otelTraceId) {
|
|
1949
|
-
const deadline = Date.now() + debug_delivery_1.INGEST_STATUS_POLL_TIMEOUT_MS;
|
|
1950
|
-
for (; ; ) {
|
|
1951
|
-
const status = await this.fetchIngestStatus(otelTraceId);
|
|
1952
|
-
if (status === null)
|
|
1953
|
-
return null;
|
|
1954
|
-
if ((0, debug_delivery_1.isSuccessfulIngestStatus)(status))
|
|
1955
|
-
return status;
|
|
1956
|
-
const remaining = deadline - Date.now();
|
|
1957
|
-
if (remaining <= 0)
|
|
1958
|
-
return status;
|
|
1959
|
-
await (0, delivery_1.sleep)(Math.min(debug_delivery_1.INGEST_STATUS_POLL_INTERVAL_MS, remaining));
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
async verifyIngestDelivery(otelTraceId) {
|
|
1963
|
-
const result = await this.pollIngestStatus(otelTraceId);
|
|
1964
|
-
if (result === null) {
|
|
1965
|
-
(0, debug_mode_1.lemmaDebug)("verify", "ingest accepted (201), ingest-status check failed (status/network)");
|
|
1966
|
-
return;
|
|
1967
|
-
}
|
|
1968
|
-
if ((0, debug_delivery_1.isSuccessfulIngestStatus)(result)) {
|
|
1969
|
-
(0, debug_mode_1.lemmaDebug)("verify", `ingest accepted (201), trace ${result === "enqueued" ? "enqueued" : `visible (${result})`} (status=${result})`);
|
|
1970
|
-
return;
|
|
1971
|
-
}
|
|
1972
|
-
(0, debug_mode_1.lemmaDebug)("verify", `ingest accepted (201), ingest-status=not_found after ${debug_delivery_1.INGEST_STATUS_POLL_TIMEOUT_MS / 1e3}s \u2014 may be processing lag or downstream issue`);
|
|
1973
|
-
}
|
|
1974
1930
|
stampRelease(payload) {
|
|
1975
1931
|
if (this.release)
|
|
1976
1932
|
payload.trace.release = this.release;
|
|
@@ -2060,8 +2016,8 @@ var require_client = __commonJS({
|
|
|
2060
2016
|
...responseHeaders,
|
|
2061
2017
|
...sentWarnings.length ? { warnings: sentWarnings } : {}
|
|
2062
2018
|
});
|
|
2063
|
-
if ((0, debug_mode_1.isDebugModeEnabled)() && (0, debug_mode_1.isDebugVerifyEnabled)()
|
|
2064
|
-
|
|
2019
|
+
if ((0, debug_mode_1.isDebugModeEnabled)() && (0, debug_mode_1.isDebugVerifyEnabled)()) {
|
|
2020
|
+
(0, debug_mode_1.noteDebugVerifyRemovedOnce)();
|
|
2065
2021
|
}
|
|
2066
2022
|
}
|
|
2067
2023
|
};
|
|
@@ -7238,7 +7194,7 @@ var import_tracing2 = __toESM(require_dist(), 1);
|
|
|
7238
7194
|
// package.json
|
|
7239
7195
|
var package_default = {
|
|
7240
7196
|
name: "@uselemma/opencode",
|
|
7241
|
-
version: "0.2.
|
|
7197
|
+
version: "0.2.1",
|
|
7242
7198
|
description: "Lemma SDK tracing for OpenCode coding-agent sessions",
|
|
7243
7199
|
license: "MIT",
|
|
7244
7200
|
author: "Lemma",
|
|
@@ -7283,12 +7239,12 @@ var package_default = {
|
|
|
7283
7239
|
prepublishOnly: "pnpm run type-check && pnpm run build"
|
|
7284
7240
|
},
|
|
7285
7241
|
dependencies: {
|
|
7286
|
-
"@opencode-ai/plugin": "1.18.19"
|
|
7287
|
-
"@uselemma/tracing": "workspace:^"
|
|
7242
|
+
"@opencode-ai/plugin": "1.18.19"
|
|
7288
7243
|
},
|
|
7289
7244
|
devDependencies: {
|
|
7290
7245
|
"@opencode-ai/sdk": "1.18.19",
|
|
7291
7246
|
"@types/node": "^22.18.8",
|
|
7247
|
+
"@uselemma/tracing": "workspace:^",
|
|
7292
7248
|
esbuild: "^0.25.11",
|
|
7293
7249
|
typescript: "^5.9.3",
|
|
7294
7250
|
vitest: "^3.2.4"
|
package/scripts/setup.mjs
CHANGED
|
@@ -111,7 +111,7 @@ async function writeDataDirLocation(dataDir, options = {}) {
|
|
|
111
111
|
// package.json
|
|
112
112
|
var package_default = {
|
|
113
113
|
name: "@uselemma/opencode",
|
|
114
|
-
version: "0.2.
|
|
114
|
+
version: "0.2.1",
|
|
115
115
|
description: "Lemma SDK tracing for OpenCode coding-agent sessions",
|
|
116
116
|
license: "MIT",
|
|
117
117
|
author: "Lemma",
|
|
@@ -156,12 +156,12 @@ var package_default = {
|
|
|
156
156
|
prepublishOnly: "pnpm run type-check && pnpm run build"
|
|
157
157
|
},
|
|
158
158
|
dependencies: {
|
|
159
|
-
"@opencode-ai/plugin": "1.18.19"
|
|
160
|
-
"@uselemma/tracing": "workspace:^"
|
|
159
|
+
"@opencode-ai/plugin": "1.18.19"
|
|
161
160
|
},
|
|
162
161
|
devDependencies: {
|
|
163
162
|
"@opencode-ai/sdk": "1.18.19",
|
|
164
163
|
"@types/node": "^22.18.8",
|
|
164
|
+
"@uselemma/tracing": "workspace:^",
|
|
165
165
|
esbuild: "^0.25.11",
|
|
166
166
|
typescript: "^5.9.3",
|
|
167
167
|
vitest: "^3.2.4"
|