@asc-agent/runtime 0.2.1 → 0.3.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/README.md +25 -25
- package/dist/adapters/claude-code/skill.js +259 -239
- package/dist/adapters/gitlab/adapter.d.ts +3 -0
- package/dist/adapters/gitlab/adapter.js +22 -3
- package/dist/adapters/gitlab/client.d.ts +27 -1
- package/dist/adapters/gitlab/client.js +30 -0
- package/dist/adapters/gitlab/ports.d.ts +3 -3
- package/dist/adapters/jam/adapter.d.ts +14 -0
- package/dist/adapters/jam/adapter.js +84 -6
- package/dist/adapters/jam/ports.d.ts +9 -0
- package/dist/adapters/jam/ports.js +49 -2
- package/dist/adapters/local/repo.d.ts +15 -0
- package/dist/adapters/local/repo.js +238 -0
- package/dist/adapters/markdown/state-store.js +13 -1
- package/dist/adapters/memory/state-store.js +4 -0
- package/dist/cli/asc.js +485 -10
- package/dist/composition/propose.d.ts +19 -0
- package/dist/composition/propose.js +35 -0
- package/dist/composition/runtime.d.ts +2 -0
- package/dist/composition/runtime.js +41 -5
- package/dist/core/attach/init.d.ts +17 -0
- package/dist/core/attach/init.js +28 -0
- package/dist/core/distribution/node-runtime.d.ts +29 -0
- package/dist/core/distribution/node-runtime.js +35 -0
- package/dist/core/distribution/release.d.ts +3 -3
- package/dist/core/distribution/release.js +1 -1
- package/dist/core/monitor/investigation.d.ts +16 -0
- package/dist/core/monitor/investigation.js +18 -9
- package/dist/core/operator/contract-draft.d.ts +124 -0
- package/dist/core/operator/contract-draft.js +234 -0
- package/dist/core/operator/derive-draft.d.ts +37 -0
- package/dist/core/operator/derive-draft.js +216 -0
- package/dist/core/operator/proceed.d.ts +79 -0
- package/dist/core/operator/proceed.js +123 -1
- package/dist/core/operator/work-state.d.ts +60 -0
- package/dist/core/operator/work-state.js +181 -0
- package/dist/core/runtime/closure.d.ts +2 -2
- package/dist/ports/local-repo.d.ts +84 -0
- package/dist/ports/local-repo.js +9 -0
- package/dist/ports/resource-context.d.ts +7 -0
- package/dist/schemas/profile.d.ts +2 -2
- package/package.json +3 -3
|
@@ -138,6 +138,13 @@ export class MarkdownStateStore {
|
|
|
138
138
|
async create(kind, entity) {
|
|
139
139
|
const id = String(entity[ENTITY_KEY[kind]]);
|
|
140
140
|
const file = entityFile(this.#root, kind, id);
|
|
141
|
+
// 회수돼 보관된 id 도 이미 쓴 id 다. 이것을 막지 않으면 같은 이름의 두 계약이 생기고,
|
|
142
|
+
// 보관 파일이 덮이면서 앞의 기록이 사라진다 (실제로 그렇게 잃었다).
|
|
143
|
+
const archived = join(archiveDir(this.#root, kind), `${toFileName(id)}.md`);
|
|
144
|
+
if (await exists(archived)) {
|
|
145
|
+
const current = (await this.#read(kind, archived));
|
|
146
|
+
return { ok: false, reason: 'ALREADY_EXISTS', current };
|
|
147
|
+
}
|
|
141
148
|
try {
|
|
142
149
|
// 'wx'가 원자적 배타 생성이라 락 없이도 중복이 걸린다
|
|
143
150
|
await writeFile(file, serializeEntity(kind, entity), { encoding: 'utf8', flag: 'wx' });
|
|
@@ -177,7 +184,12 @@ export class MarkdownStateStore {
|
|
|
177
184
|
return false;
|
|
178
185
|
const dir = archiveDir(this.#root, kind);
|
|
179
186
|
await mkdir(dir, { recursive: true });
|
|
180
|
-
|
|
187
|
+
const to = join(dir, `${toFileName(id)}.md`);
|
|
188
|
+
// 보관은 덮어쓰기가 아니다. 같은 이름이 이미 있으면 옮기지 않고 그대로 둔다 —
|
|
189
|
+
// 기록 하나를 살리자고 다른 기록을 지우지 않는다.
|
|
190
|
+
if (await exists(to))
|
|
191
|
+
return false;
|
|
192
|
+
await rename(from, to);
|
|
181
193
|
return true;
|
|
182
194
|
}
|
|
183
195
|
// ── Control State ─────────────────────────────────────────────────────────
|
|
@@ -36,6 +36,10 @@ export class MemoryStateStore {
|
|
|
36
36
|
const existing = table.get(id);
|
|
37
37
|
if (existing)
|
|
38
38
|
return { ok: false, reason: 'ALREADY_EXISTS', current: clone(existing) };
|
|
39
|
+
// 회수된 것도 쓴 id 다. 다시 쓰면 그 기록 위에 다른 계약이 앉는다.
|
|
40
|
+
const archived = this.#archived.get(kind)?.get(id);
|
|
41
|
+
if (archived)
|
|
42
|
+
return { ok: false, reason: 'ALREADY_EXISTS', current: clone(archived) };
|
|
39
43
|
table.set(id, clone(entity));
|
|
40
44
|
return { ok: true, entity: clone(entity) };
|
|
41
45
|
}
|