opencode-gitlab-dap 1.8.2 → 1.8.3
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/index.cjs +72 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3468,12 +3468,43 @@ async function safeRead(instanceUrl, token, scope, id, slug) {
|
|
|
3468
3468
|
return null;
|
|
3469
3469
|
}
|
|
3470
3470
|
}
|
|
3471
|
+
var MAX_RETRIES = 3;
|
|
3472
|
+
var RETRY_DELAY_MS = 1e3;
|
|
3473
|
+
async function sleep2(ms) {
|
|
3474
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3475
|
+
}
|
|
3471
3476
|
async function appendToPage(instanceUrl, token, scope, id, slug, newContent) {
|
|
3477
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
|
3478
|
+
const existing2 = await safeRead(instanceUrl, token, scope, id, slug);
|
|
3479
|
+
if (existing2 !== null) {
|
|
3480
|
+
try {
|
|
3481
|
+
await updateWikiPage(instanceUrl, token, scope, id, slug, existing2 + "\n\n" + newContent);
|
|
3482
|
+
return;
|
|
3483
|
+
} catch (err) {
|
|
3484
|
+
if (attempt < MAX_RETRIES - 1 && err.message?.includes("reference update")) {
|
|
3485
|
+
await sleep2(RETRY_DELAY_MS * (attempt + 1));
|
|
3486
|
+
continue;
|
|
3487
|
+
}
|
|
3488
|
+
throw err;
|
|
3489
|
+
}
|
|
3490
|
+
} else {
|
|
3491
|
+
try {
|
|
3492
|
+
await createWikiPage(instanceUrl, token, scope, id, slug, newContent);
|
|
3493
|
+
return;
|
|
3494
|
+
} catch (err) {
|
|
3495
|
+
if (err.message?.includes("Duplicate page") || err.message?.includes("reference update")) {
|
|
3496
|
+
await sleep2(RETRY_DELAY_MS * (attempt + 1));
|
|
3497
|
+
continue;
|
|
3498
|
+
}
|
|
3499
|
+
throw err;
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3472
3503
|
const existing = await safeRead(instanceUrl, token, scope, id, slug);
|
|
3473
3504
|
if (existing !== null) {
|
|
3474
3505
|
await updateWikiPage(instanceUrl, token, scope, id, slug, existing + "\n\n" + newContent);
|
|
3475
3506
|
} else {
|
|
3476
|
-
|
|
3507
|
+
throw new Error(`Failed to append to ${slug} after ${MAX_RETRIES} retries`);
|
|
3477
3508
|
}
|
|
3478
3509
|
}
|
|
3479
3510
|
function validateProjectId(projectId) {
|
|
@@ -3615,20 +3646,32 @@ ${args.content}`;
|
|
|
3615
3646
|
const { scope, id } = resolveScope(args);
|
|
3616
3647
|
const date = today();
|
|
3617
3648
|
const slug = `${PREFIX}/memory/sessions/${date}-${slugify(args.title)}`;
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3649
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
|
3650
|
+
try {
|
|
3651
|
+
await createWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.summary);
|
|
3652
|
+
return `Session logged: ${slug}`;
|
|
3653
|
+
} catch (err) {
|
|
3654
|
+
const msg = err.message ?? "";
|
|
3655
|
+
if (msg.includes("Duplicate page") || msg.includes("already exists") || msg.includes("422")) {
|
|
3656
|
+
try {
|
|
3657
|
+
await updateWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.summary);
|
|
3658
|
+
return `Session log updated: ${slug}`;
|
|
3659
|
+
} catch (err2) {
|
|
3660
|
+
if (attempt < MAX_RETRIES - 1 && err2.message?.includes("reference update")) {
|
|
3661
|
+
await sleep2(RETRY_DELAY_MS * (attempt + 1));
|
|
3662
|
+
continue;
|
|
3663
|
+
}
|
|
3664
|
+
return `Error logging session: ${err2.message}`;
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
if (attempt < MAX_RETRIES - 1 && msg.includes("reference update")) {
|
|
3668
|
+
await sleep2(RETRY_DELAY_MS * (attempt + 1));
|
|
3669
|
+
continue;
|
|
3628
3670
|
}
|
|
3671
|
+
return `Error logging session: ${msg}`;
|
|
3629
3672
|
}
|
|
3630
|
-
return `Error logging session: ${err.message}`;
|
|
3631
3673
|
}
|
|
3674
|
+
return `Error logging session: failed after ${MAX_RETRIES} retries`;
|
|
3632
3675
|
}
|
|
3633
3676
|
})
|
|
3634
3677
|
};
|
|
@@ -3756,17 +3799,26 @@ ${draft.content}`;
|
|
|
3756
3799
|
const { scope, id } = resolveScope2(args);
|
|
3757
3800
|
const prefix = args.draft ? DRAFTS_PREFIX : SKILLS_PREFIX;
|
|
3758
3801
|
const slug = `${prefix}/${args.name}`;
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
return `Updated ${args.draft ? "draft " : ""}skill: ${args.name}`;
|
|
3762
|
-
} catch {
|
|
3802
|
+
const label = args.draft ? "draft " : "";
|
|
3803
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
3763
3804
|
try {
|
|
3764
|
-
await
|
|
3765
|
-
return `
|
|
3766
|
-
} catch
|
|
3767
|
-
|
|
3805
|
+
await updateWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.content);
|
|
3806
|
+
return `Updated ${label}skill: ${args.name}`;
|
|
3807
|
+
} catch {
|
|
3808
|
+
try {
|
|
3809
|
+
await createWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.content);
|
|
3810
|
+
return `Created ${label}skill: ${args.name}`;
|
|
3811
|
+
} catch (err) {
|
|
3812
|
+
const msg = err.message ?? "";
|
|
3813
|
+
if (msg.includes("Duplicate page") || msg.includes("reference update")) {
|
|
3814
|
+
await new Promise((r) => setTimeout(r, 1e3 * (attempt + 1)));
|
|
3815
|
+
continue;
|
|
3816
|
+
}
|
|
3817
|
+
return `Error saving skill: ${msg}`;
|
|
3818
|
+
}
|
|
3768
3819
|
}
|
|
3769
3820
|
}
|
|
3821
|
+
return `Error saving skill: failed after 3 retries`;
|
|
3770
3822
|
}
|
|
3771
3823
|
}),
|
|
3772
3824
|
gitlab_skill_promote: tool6({
|