@keystrokehq/keystroke 0.1.63 → 0.1.64
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-types.cjs +1 -1
- package/dist/agent-types.d.cts +2 -2
- package/dist/agent-types.d.mts +2 -2
- package/dist/agent-types.mjs +1 -1
- package/dist/agent.cjs +3 -11
- package/dist/agent.cjs.map +1 -1
- package/dist/agent.d.cts +3 -3
- package/dist/agent.d.mts +3 -3
- package/dist/agent.mjs +3 -11
- package/dist/agent.mjs.map +1 -1
- package/dist/{context-compaction-B2veGznA-CdNhgfb-.cjs → context-compaction-B2veGznA-CaL3m_s8.cjs} +2 -2
- package/dist/{context-compaction-B2veGznA-CdNhgfb-.cjs.map → context-compaction-B2veGznA-CaL3m_s8.cjs.map} +1 -1
- package/dist/{context-compaction-B2veGznA-fTsVT80w.mjs → context-compaction-B2veGznA-CqXQb-my.mjs} +2 -2
- package/dist/{context-compaction-B2veGznA-fTsVT80w.mjs.map → context-compaction-B2veGznA-CqXQb-my.mjs.map} +1 -1
- package/dist/{dist-Bxgv3ILc.mjs → dist-5QM3AD9a.mjs} +3 -125
- package/dist/dist-5QM3AD9a.mjs.map +1 -0
- package/dist/{dist-C0SlRvap.mjs → dist-D2lMFHrf.mjs} +2 -2
- package/dist/{dist-C0SlRvap.mjs.map → dist-D2lMFHrf.mjs.map} +1 -1
- package/dist/{dist-CqLIePYW.cjs → dist-Dvd9k8Ai.cjs} +2 -2
- package/dist/{dist-CqLIePYW.cjs.map → dist-Dvd9k8Ai.cjs.map} +1 -1
- package/dist/{dist-FvKVcgN5.cjs → dist-Dx5LXxtl.cjs} +2 -130
- package/dist/dist-Dx5LXxtl.cjs.map +1 -0
- package/dist/{index-B08z0uxo.d.mts → index-7bWU2yaq.d.mts} +2 -2
- package/dist/{index-Dz9SDHVa.d.cts.map → index-7bWU2yaq.d.mts.map} +1 -1
- package/dist/{index-BL0m4qM4.d.mts → index-BolOkiNw.d.mts} +13 -2
- package/dist/index-BolOkiNw.d.mts.map +1 -0
- package/dist/{index-D_HoBfcD.d.mts → index-Co2_egnk.d.mts} +4 -4
- package/dist/{index-D_HoBfcD.d.mts.map → index-Co2_egnk.d.mts.map} +1 -1
- package/dist/{index-BT2E1slw.d.cts → index-DNg4hc8A.d.cts} +4 -4
- package/dist/{index-BT2E1slw.d.cts.map → index-DNg4hc8A.d.cts.map} +1 -1
- package/dist/{index-Dz9SDHVa.d.cts → index-DqlM5r4Y.d.cts} +2 -2
- package/dist/{index-B08z0uxo.d.mts.map → index-DqlM5r4Y.d.cts.map} +1 -1
- package/dist/{index-DET6ZCmJ.d.cts → index-GJs4NjSJ.d.cts} +13 -2
- package/dist/index-GJs4NjSJ.d.cts.map +1 -0
- package/dist/{schemas-B9dXuD9C-LLqP3vYX.d.cts → schemas-B9dXuD9C-C1Fob77y.d.cts} +2 -2
- package/dist/{schemas-B9dXuD9C-BFuog8tV.d.mts.map → schemas-B9dXuD9C-C1Fob77y.d.cts.map} +1 -1
- package/dist/{schemas-B9dXuD9C-BFuog8tV.d.mts → schemas-B9dXuD9C-DmZb8lNi.d.mts} +2 -2
- package/dist/{schemas-B9dXuD9C-LLqP3vYX.d.cts.map → schemas-B9dXuD9C-DmZb8lNi.d.mts.map} +1 -1
- package/dist/{token-DPX8utYi.mjs → token-DH_A8nQu.mjs} +2 -2
- package/dist/{token-DPX8utYi.mjs.map → token-DH_A8nQu.mjs.map} +1 -1
- package/dist/{token-Bm94B1Q2.cjs → token-_JNYaTJh.cjs} +2 -2
- package/dist/{token-Bm94B1Q2.cjs.map → token-_JNYaTJh.cjs.map} +1 -1
- package/dist/trigger.cjs +1 -1
- package/dist/trigger.d.cts +1 -1
- package/dist/trigger.d.mts +1 -1
- package/dist/trigger.mjs +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.mjs +1 -1
- package/package.json +1 -1
- package/dist/dist-Bxgv3ILc.mjs.map +0 -1
- package/dist/dist-FvKVcgN5.cjs.map +0 -1
- package/dist/index-BL0m4qM4.d.mts.map +0 -1
- package/dist/index-DET6ZCmJ.d.cts.map +0 -1
|
@@ -3158,50 +3158,6 @@ const agentEventsSqlite = sqliteTable("agent_events", {
|
|
|
3158
3158
|
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
3159
3159
|
deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
|
|
3160
3160
|
}, (table) => [index("agent_events_session_event_seq_idx").on(table.sessionId, table.eventType, table.seq)]);
|
|
3161
|
-
const usageRecords = pgTable("usage_records", {
|
|
3162
|
-
id: text$2("id").primaryKey(),
|
|
3163
|
-
runId: text$2("run_id"),
|
|
3164
|
-
runKind: text$2("run_kind").$type(),
|
|
3165
|
-
kind: text$2("kind").notNull(),
|
|
3166
|
-
label: text$2("label").notNull(),
|
|
3167
|
-
quantity: integer$1("quantity"),
|
|
3168
|
-
unit: text$2("unit"),
|
|
3169
|
-
amount: doublePrecision("amount").notNull(),
|
|
3170
|
-
metadata: jsonb("metadata"),
|
|
3171
|
-
entryType: text$2("entry_type").$type().notNull().default("usage"),
|
|
3172
|
-
meterKey: text$2("meter_key"),
|
|
3173
|
-
microCredits: bigint("micro_credits", { mode: "number" }),
|
|
3174
|
-
bucket: text$2("bucket").$type(),
|
|
3175
|
-
reference: text$2("reference"),
|
|
3176
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
3177
|
-
}, (table) => [
|
|
3178
|
-
index$1("usage_records_run_run_kind_idx").on(table.runId, table.runKind),
|
|
3179
|
-
index$1("usage_records_kind_idx").on(table.kind),
|
|
3180
|
-
index$1("usage_records_entry_type_created_at_idx").on(table.entryType, table.createdAt),
|
|
3181
|
-
uniqueIndex$1("usage_records_entry_type_reference_unique").on(table.entryType, table.reference).where(sql`${table.reference} is not null`)
|
|
3182
|
-
]);
|
|
3183
|
-
const usageRecordsSqlite = sqliteTable("usage_records", {
|
|
3184
|
-
id: text$1("id").primaryKey(),
|
|
3185
|
-
runId: text$1("run_id"),
|
|
3186
|
-
runKind: text$1("run_kind").$type(),
|
|
3187
|
-
kind: text$1("kind").notNull(),
|
|
3188
|
-
label: text$1("label").notNull(),
|
|
3189
|
-
quantity: integer("quantity"),
|
|
3190
|
-
unit: text$1("unit"),
|
|
3191
|
-
amount: real("amount").notNull(),
|
|
3192
|
-
metadata: text$1("metadata", { mode: "json" }),
|
|
3193
|
-
entryType: text$1("entry_type").$type().notNull().default("usage"),
|
|
3194
|
-
meterKey: text$1("meter_key"),
|
|
3195
|
-
microCredits: integer("micro_credits"),
|
|
3196
|
-
bucket: text$1("bucket").$type(),
|
|
3197
|
-
reference: text$1("reference"),
|
|
3198
|
-
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull()
|
|
3199
|
-
}, (table) => [
|
|
3200
|
-
index("usage_records_run_run_kind_idx").on(table.runId, table.runKind),
|
|
3201
|
-
index("usage_records_kind_idx").on(table.kind),
|
|
3202
|
-
index("usage_records_entry_type_created_at_idx").on(table.entryType, table.createdAt),
|
|
3203
|
-
uniqueIndex("usage_records_entry_type_reference_unique").on(table.entryType, table.reference).where(sql`${table.reference} is not null`)
|
|
3204
|
-
]);
|
|
3205
3161
|
const triggers = pgTable("triggers", {
|
|
3206
3162
|
id: text$2("id").primaryKey(),
|
|
3207
3163
|
projectId: text$2("project_id").notNull(),
|
|
@@ -3702,53 +3658,6 @@ const resourceActivitySqlite = sqliteTable("resource_activity", {
|
|
|
3702
3658
|
lastOpenedAt: integer("last_opened_at", { mode: "timestamp_ms" }).notNull()
|
|
3703
3659
|
}, (table) => [uniqueIndex("resource_activity_project_user_kind_resource").on(table.projectId, table.userId, table.resourceKind, table.resourceId), index("resource_activity_user_last_opened_at").on(table.userId, table.lastOpenedAt)]);
|
|
3704
3660
|
/**
|
|
3705
|
-
* Legacy org-runtime billing cache. Platform cloud financial authority now
|
|
3706
|
-
* lives in `@keystrokehq/platform-database`; keep this table for existing org
|
|
3707
|
-
* databases and pushed-down runtime plan hints, but do not add new billing
|
|
3708
|
-
* writers here.
|
|
3709
|
-
*
|
|
3710
|
-
* Single-row prepaid credit wallet + pushed-down plan config for the org
|
|
3711
|
-
* (the org runtime DB is per-org). Cache of `SUM(usage_records.microCredits)`,
|
|
3712
|
-
* updated in the same transaction as each ledger insert. Cloud-only: standalone
|
|
3713
|
-
* never writes it. All billing logic lives in `packages/cloud/*`.
|
|
3714
|
-
*/
|
|
3715
|
-
const billingWallet = pgTable("billing_wallet", {
|
|
3716
|
-
organizationId: text$2("organization_id").primaryKey(),
|
|
3717
|
-
planCreditMicroCredits: bigint("plan_credit_micro_credits", { mode: "number" }).notNull().default(0),
|
|
3718
|
-
prepaidCreditMicroCredits: bigint("prepaid_credit_micro_credits", { mode: "number" }).notNull().default(0),
|
|
3719
|
-
periodStart: timestamp("period_start", { withTimezone: true }),
|
|
3720
|
-
periodEnd: timestamp("period_end", { withTimezone: true }),
|
|
3721
|
-
planKey: text$2("plan_key"),
|
|
3722
|
-
monthlyCreditMicroCredits: bigint("monthly_credit_micro_credits", { mode: "number" }),
|
|
3723
|
-
includedStorageGb: integer$1("included_storage_gb"),
|
|
3724
|
-
concurrencyLimit: integer$1("concurrency_limit"),
|
|
3725
|
-
agentTimeoutMs: integer$1("agent_timeout_ms"),
|
|
3726
|
-
workflowTimeoutMs: integer$1("workflow_timeout_ms"),
|
|
3727
|
-
pollTimeoutMs: integer$1("poll_timeout_ms"),
|
|
3728
|
-
logRetentionDays: integer$1("log_retention_days"),
|
|
3729
|
-
autoTopupEnabled: integer$1("auto_topup_enabled").notNull().default(0),
|
|
3730
|
-
autoTopupThresholdMicroCredits: bigint("auto_topup_threshold_micro_credits", { mode: "number" }),
|
|
3731
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
3732
|
-
});
|
|
3733
|
-
const billingWalletSqlite = sqliteTable("billing_wallet", {
|
|
3734
|
-
organizationId: text$1("organization_id").primaryKey(),
|
|
3735
|
-
planCreditMicroCredits: integer("plan_credit_micro_credits").notNull().default(0),
|
|
3736
|
-
prepaidCreditMicroCredits: integer("prepaid_credit_micro_credits").notNull().default(0),
|
|
3737
|
-
periodStart: integer("period_start", { mode: "timestamp_ms" }),
|
|
3738
|
-
periodEnd: integer("period_end", { mode: "timestamp_ms" }),
|
|
3739
|
-
planKey: text$1("plan_key"),
|
|
3740
|
-
monthlyCreditMicroCredits: integer("monthly_credit_micro_credits"),
|
|
3741
|
-
includedStorageGb: integer("included_storage_gb"),
|
|
3742
|
-
concurrencyLimit: integer("concurrency_limit"),
|
|
3743
|
-
agentTimeoutMs: integer("agent_timeout_ms"),
|
|
3744
|
-
workflowTimeoutMs: integer("workflow_timeout_ms"),
|
|
3745
|
-
pollTimeoutMs: integer("poll_timeout_ms"),
|
|
3746
|
-
logRetentionDays: integer("log_retention_days"),
|
|
3747
|
-
autoTopupEnabled: integer("auto_topup_enabled").notNull().default(0),
|
|
3748
|
-
autoTopupThresholdMicroCredits: integer("auto_topup_threshold_micro_credits"),
|
|
3749
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
3750
|
-
});
|
|
3751
|
-
/**
|
|
3752
3661
|
* Project server tables — Postgres (hosted) or SQLite (local dev).
|
|
3753
3662
|
*/
|
|
3754
3663
|
const tableRegistry = {
|
|
@@ -3764,10 +3673,6 @@ const tableRegistry = {
|
|
|
3764
3673
|
pg: agentEvents,
|
|
3765
3674
|
sqlite: agentEventsSqlite
|
|
3766
3675
|
},
|
|
3767
|
-
usageRecords: {
|
|
3768
|
-
pg: usageRecords,
|
|
3769
|
-
sqlite: usageRecordsSqlite
|
|
3770
|
-
},
|
|
3771
3676
|
triggers: {
|
|
3772
3677
|
pg: triggers,
|
|
3773
3678
|
sqlite: triggersSqlite
|
|
@@ -3835,10 +3740,6 @@ const tableRegistry = {
|
|
|
3835
3740
|
resourceActivity: {
|
|
3836
3741
|
pg: resourceActivity,
|
|
3837
3742
|
sqlite: resourceActivitySqlite
|
|
3838
|
-
},
|
|
3839
|
-
billingWallet: {
|
|
3840
|
-
pg: billingWallet,
|
|
3841
|
-
sqlite: billingWalletSqlite
|
|
3842
3743
|
}
|
|
3843
3744
|
};
|
|
3844
3745
|
buildPgSchema(tableRegistry);
|
|
@@ -3914,14 +3815,6 @@ async function hasAgentEventAfterSeq(sessionId, eventType, afterSeq) {
|
|
|
3914
3815
|
async function listAgentEventsForSession(sessionId) {
|
|
3915
3816
|
return (await getDb().select({ event: agentEvents }).from(agentEvents).innerJoin(agentSessions, eq(agentSessions.id, agentEvents.sessionId)).where(scopedAnd(agentSessions, eq(agentEvents.sessionId, sessionId), isNull(agentEvents.deletedAt))).orderBy(asc(agentEvents.seq))).map((row) => row.event);
|
|
3916
3817
|
}
|
|
3917
|
-
async function insertUsageRecord(values) {
|
|
3918
|
-
await getDb().insert(usageRecords).values({
|
|
3919
|
-
...values,
|
|
3920
|
-
quantity: values.quantity ?? null,
|
|
3921
|
-
unit: values.unit ?? null,
|
|
3922
|
-
metadata: values.metadata ?? null
|
|
3923
|
-
});
|
|
3924
|
-
}
|
|
3925
3818
|
/** Fetch active skills by slug for the current project scope. */
|
|
3926
3819
|
async function selectActiveSkillsBySlugs(slugs) {
|
|
3927
3820
|
if (slugs.length === 0) return [];
|
|
@@ -4104,21 +3997,6 @@ async function hasSessionEventAfterSeq(sessionId, eventType, afterSeq) {
|
|
|
4104
3997
|
async function setSessionStatus(sessionId, status) {
|
|
4105
3998
|
await updateAgentSessionStatus(sessionId, status);
|
|
4106
3999
|
}
|
|
4107
|
-
async function recordLlmUsageFromAssistantMessage(options) {
|
|
4108
|
-
const { usage } = options;
|
|
4109
|
-
await insertUsageRecord({
|
|
4110
|
-
id: crypto.randomUUID(),
|
|
4111
|
-
runId: options.sessionId,
|
|
4112
|
-
runKind: "agent",
|
|
4113
|
-
kind: "llm",
|
|
4114
|
-
label: usage.label,
|
|
4115
|
-
quantity: usage.quantity,
|
|
4116
|
-
unit: "tokens",
|
|
4117
|
-
amount: usage.amount,
|
|
4118
|
-
metadata: usage.metadata,
|
|
4119
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
4120
|
-
});
|
|
4121
|
-
}
|
|
4122
4000
|
function serializeSpanError(error) {
|
|
4123
4001
|
if (error instanceof Error) return {
|
|
4124
4002
|
name: error.name,
|
|
@@ -6866,7 +6744,7 @@ var require_get_vercel_oidc_token = /* @__PURE__ */ require_chunk.__commonJSMin(
|
|
|
6866
6744
|
err = error;
|
|
6867
6745
|
}
|
|
6868
6746
|
try {
|
|
6869
|
-
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([await Promise.resolve().then(() => /* @__PURE__ */ require_chunk.__toESM(require_token_util())), await Promise.resolve().then(() => /* @__PURE__ */ require_chunk.__toESM(require("./token-
|
|
6747
|
+
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([await Promise.resolve().then(() => /* @__PURE__ */ require_chunk.__toESM(require_token_util())), await Promise.resolve().then(() => /* @__PURE__ */ require_chunk.__toESM(require("./token-_JNYaTJh.cjs").default))]);
|
|
6870
6748
|
if (!token || isExpired(getTokenPayload(token), options?.expirationBufferMs)) {
|
|
6871
6749
|
await refreshToken(options);
|
|
6872
6750
|
token = getVercelOidcTokenSync();
|
|
@@ -17775,12 +17653,6 @@ Object.defineProperty(exports, "real", {
|
|
|
17775
17653
|
return real;
|
|
17776
17654
|
}
|
|
17777
17655
|
});
|
|
17778
|
-
Object.defineProperty(exports, "recordLlmUsageFromAssistantMessage", {
|
|
17779
|
-
enumerable: true,
|
|
17780
|
-
get: function() {
|
|
17781
|
-
return recordLlmUsageFromAssistantMessage;
|
|
17782
|
-
}
|
|
17783
|
-
});
|
|
17784
17656
|
Object.defineProperty(exports, "require_token_error", {
|
|
17785
17657
|
enumerable: true,
|
|
17786
17658
|
get: function() {
|
|
@@ -17926,4 +17798,4 @@ Object.defineProperty(exports, "wrapLanguageModel", {
|
|
|
17926
17798
|
}
|
|
17927
17799
|
});
|
|
17928
17800
|
|
|
17929
|
-
//# sourceMappingURL=dist-
|
|
17801
|
+
//# sourceMappingURL=dist-Dx5LXxtl.cjs.map
|