Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ console.log(promoted.promoted)
Calling it again with the same `runId` resumes interrupted work.
`withKnowledgeImprovementCandidate` materializes the measured bytes in an isolated temporary directory for the callback, checks them again afterward, and removes the directory.
`promoteKnowledgeCandidate` applies only the frozen bytes identified by the approved candidate reference, and refuses if the live base changed.
The current release intentionally accepts only its strict run-state format; incomplete runs created by 1.x must be completed or restarted before upgrading.
The current release accepts one strict run-state format; incomplete runs created before 3.0 must be completed or restarted before upgrading.
The exact candidate workflow requires Linux; other knowledge, retrieval, and evaluation APIs remain cross-platform.

If a required phase is missing its hook, the loop throws.
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tangle-network/agent-knowledge",
"version": "2.0.1",
"version": "3.0.0",
"description": "Source-grounded, eval-gated knowledge growth primitives for agents.",
"homepage": "https://github.com/tangle-network/agent-knowledge#readme",
"repository": {
Expand Down Expand Up @@ -68,8 +68,8 @@
"format": "biome format --write src tests"
},
"dependencies": {
"@tangle-network/agent-eval": "^0.119.1",
"@tangle-network/agent-interface": "^0.26.1",
"@tangle-network/agent-eval": "^0.121.0",
"@tangle-network/agent-interface": "^0.28.0",
"proper-lockfile": "4.1.2",
"zod": "^4.3.6"
},
Expand All @@ -88,6 +88,7 @@
"minimumReleaseAge": 4320,
"minimumReleaseAgeExclude": [
"@tangle-network/agent-eval",
"@tangle-network/agent-interface",
"@tangle-network/sandbox"
],
"overrides": {
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/file-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const transactionEntrySchema = z
.strict()
const transactionSchema = z
.object({
schemaVersion: z.literal(1),
kind: z.literal('knowledge-file-transaction'),
transactionId: z.string().uuid(),
purpose: z.string().min(1),
Expand All @@ -41,7 +40,6 @@ const transactionSchema = z
.strict()
const transactionDirectionSchema = z
.object({
schemaVersion: z.literal(1),
transactionId: z.string().uuid(),
direction: z.literal('rollback'),
})
Expand Down Expand Up @@ -158,7 +156,6 @@ export async function prepareKnowledgeFileTransaction(input: {
}
}
const transaction = transactionSchema.parse({
schemaVersion: 1,
kind: 'knowledge-file-transaction',
transactionId: randomUUID(),
purpose: input.purpose,
Expand Down Expand Up @@ -397,7 +394,6 @@ export async function rollbackKnowledgeFileTransaction(input: {
const direction = await readTransactionDirection(transactionDir, transaction)
if (direction !== 'rollback') {
await writeJsonDurable(join(transactionDir, 'direction.json'), {
schemaVersion: 1,
transactionId: transaction.transactionId,
direction: 'rollback',
})
Expand Down
7 changes: 0 additions & 7 deletions src/kb-improvement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export interface KnowledgeImprovementCandidateRecord {
}

export interface KnowledgeImprovementRunState {
schemaVersion: 1
runId: string
root: string
goal: string
Expand Down Expand Up @@ -243,7 +242,6 @@ const candidateRecordSchema = z

export const KnowledgeImprovementRunStateSchema = z
.object({
schemaVersion: z.literal(1),
runId: runIdSchema,
root: z.string().min(1),
goal: z.string().min(1),
Expand Down Expand Up @@ -351,7 +349,6 @@ export const KnowledgeImprovementRunStateSchema = z

export const KnowledgeImprovementEvidenceSchema = z
.object({
schemaVersion: z.literal(1),
kind: z.literal('knowledge-improvement-evidence'),
runId: runIdSchema,
candidateId: safePathSegmentSchema,
Expand All @@ -373,7 +370,6 @@ export type KnowledgeImprovementEvidence = z.infer<typeof KnowledgeImprovementEv
/** Portable identity of one measured candidate. Paths and mutable run state are deliberately excluded. */
export const KnowledgeImprovementCandidateRefSchema = z
.object({
schemaVersion: z.literal(1),
kind: z.literal('knowledge-improvement-candidate'),
runId: runIdSchema,
candidateId: safePathSegmentSchema,
Expand Down Expand Up @@ -661,7 +657,6 @@ async function improveKnowledgeBaseInRun(
const baseHash = await hashKnowledgeBase(options.root)
await createBaselineSnapshot(runDir, options.root, baseHash)
state = {
schemaVersion: 1,
runId,
root: options.root,
goal: options.goal,
Expand Down Expand Up @@ -1070,7 +1065,6 @@ function candidateRefFor(
throw new Error(`knowledge candidate '${candidate.candidateId}' is not ready`)
}
return Object.freeze({
schemaVersion: 1,
kind: 'knowledge-improvement-candidate',
runId,
candidateId: candidate.candidateId,
Expand Down Expand Up @@ -1509,7 +1503,6 @@ async function evaluateCandidate(
const evidence = KnowledgeImprovementEvidenceSchema.parse(
JSON.parse(
JSON.stringify({
schemaVersion: 1,
kind: 'knowledge-improvement-evidence',
runId: state.runId,
candidateId: candidate.candidateId,
Expand Down
6 changes: 4 additions & 2 deletions tests/agent-candidate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import type { KnowledgeImprovementCandidateRef } from '../src/kb-improvement'

const candidate: KnowledgeImprovementCandidateRef = {
schemaVersion: 1,
kind: 'knowledge-improvement-candidate',
runId: 'knowledge-run',
candidateId: 'candidate-1',
Expand All @@ -23,7 +22,6 @@ const candidate: KnowledgeImprovementCandidateRef = {
}

const sharedCandidate: AgentCandidateKnowledgeRef = {
schemaVersion: 1,
kind: 'knowledge-improvement-candidate',
runId: 'knowledge-run',
candidateId: 'candidate-1',
Expand Down Expand Up @@ -52,4 +50,8 @@ describe('agent candidate knowledge references', () => {
fromAgentCandidateKnowledgeRef({ ...shared, candidateHash: 'sha256:bad' }),
).toThrow()
})

it('rejects obsolete schema markers', () => {
expect(() => fromAgentCandidateKnowledgeRef({ ...sharedCandidate, schemaVersion: 1 })).toThrow()
})
})
1 change: 1 addition & 0 deletions tests/file-transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('knowledge file transactions', () => {
],
})
expect(prepared).not.toBeNull()
expect(prepared).not.toHaveProperty('schemaVersion')

await expect(
applyKnowledgeFileTransaction({
Expand Down
Loading