@ycodium-ai/plugin-team 0.2.4228 → 0.2.4256
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.js +63 -60
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all3) => {
|
|
|
8
8
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
9
9
|
|
|
10
10
|
// ../../packages/plugin-api/src/version.ts
|
|
11
|
-
var PLUGIN_API_VERSION =
|
|
11
|
+
var PLUGIN_API_VERSION = 106;
|
|
12
12
|
|
|
13
13
|
// ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=78523ded7c3dfc3efd3cec0247f4960d00eaa3d3c96a2077457694a4d8b453c6/node_modules/effect/dist/Pipeable.js
|
|
14
14
|
var pipeArguments = (self, args2) => {
|
|
@@ -10695,71 +10695,78 @@ var assigneeMembers = (principals) => [
|
|
|
10695
10695
|
];
|
|
10696
10696
|
|
|
10697
10697
|
// src/runtime/deliveryPacing.ts
|
|
10698
|
+
var pairKey = (a, b) => JSON.stringify([a, b].sort());
|
|
10699
|
+
var decodeCount = decodeUnknownOption2(
|
|
10700
|
+
Struct({ threadId: String4, peerThreadId: String4, halfTrips: Number5 })
|
|
10701
|
+
);
|
|
10702
|
+
var decodeReset = decodeUnknownOption2(
|
|
10703
|
+
Struct({ threadId: String4, peerThreadId: optionalKey2(String4) })
|
|
10704
|
+
);
|
|
10698
10705
|
function foldProgress(state, event) {
|
|
10706
|
+
if (event.type === "communication.wake-loop-updated") {
|
|
10707
|
+
const decoded2 = decodeCount(event.payload);
|
|
10708
|
+
if (isNone2(decoded2)) return state;
|
|
10709
|
+
const count2 = decoded2.value;
|
|
10710
|
+
return {
|
|
10711
|
+
...state,
|
|
10712
|
+
counts: { ...state.counts, [pairKey(count2.threadId, count2.peerThreadId)]: count2 }
|
|
10713
|
+
};
|
|
10714
|
+
}
|
|
10715
|
+
if (event.type === "communication.wake-loops-reset") {
|
|
10716
|
+
const decoded2 = decodeReset(event.payload);
|
|
10717
|
+
if (isNone2(decoded2)) return state;
|
|
10718
|
+
const { threadId: threadId2, peerThreadId } = decoded2.value;
|
|
10719
|
+
const removed = new Set(
|
|
10720
|
+
Object.entries(state.counts).filter(
|
|
10721
|
+
([, pair]) => peerThreadId === void 0 ? pair.threadId === threadId2 || pair.peerThreadId === threadId2 : pairKey(pair.threadId, pair.peerThreadId) === pairKey(threadId2, peerThreadId)
|
|
10722
|
+
).map(([key]) => key)
|
|
10723
|
+
);
|
|
10724
|
+
return {
|
|
10725
|
+
counts: Object.fromEntries(Object.entries(state.counts).filter(([key]) => !removed.has(key))),
|
|
10726
|
+
baselines: Object.fromEntries(
|
|
10727
|
+
Object.entries(state.baselines).map(([thread, pairs]) => [
|
|
10728
|
+
thread,
|
|
10729
|
+
Object.fromEntries(Object.entries(pairs).filter(([key]) => !removed.has(key)))
|
|
10730
|
+
])
|
|
10731
|
+
)
|
|
10732
|
+
};
|
|
10733
|
+
}
|
|
10699
10734
|
const decoded = decodeWorkEvent(event);
|
|
10700
10735
|
if (isNone2(decoded) || decoded.value.type !== "work.item-updated") return state;
|
|
10701
10736
|
const { actor, state: changed } = decoded.value.payload;
|
|
10702
10737
|
if (actor?.threadId === void 0 || changed?.group === void 0) return state;
|
|
10703
|
-
const
|
|
10704
|
-
|
|
10738
|
+
const threadId = actor.threadId;
|
|
10739
|
+
const baseline = Object.fromEntries(
|
|
10740
|
+
Object.entries(state.counts).filter(([, pair]) => pair.threadId === threadId || pair.peerThreadId === threadId).map(([key, pair]) => [key, pair.halfTrips])
|
|
10741
|
+
);
|
|
10742
|
+
return { ...state, baselines: { ...state.baselines, [threadId]: baseline } };
|
|
10705
10743
|
}
|
|
10706
10744
|
var deliveryPacingStateDefinition = {
|
|
10707
10745
|
key: "delivery-pacing",
|
|
10708
|
-
version:
|
|
10709
|
-
events: [
|
|
10710
|
-
|
|
10746
|
+
version: 2,
|
|
10747
|
+
events: [
|
|
10748
|
+
"work.item-updated",
|
|
10749
|
+
"communication.wake-loop-updated",
|
|
10750
|
+
"communication.wake-loops-reset"
|
|
10751
|
+
],
|
|
10752
|
+
init: () => ({ counts: {}, baselines: {} }),
|
|
10711
10753
|
apply: foldProgress
|
|
10712
10754
|
};
|
|
10713
|
-
var decodeSession = decodeUnknownOption2(
|
|
10714
|
-
Struct({
|
|
10715
|
-
threadId: String4,
|
|
10716
|
-
session: NullOr(
|
|
10717
|
-
Struct({ status: String4, activeTurnId: NullOr(String4) })
|
|
10718
|
-
)
|
|
10719
|
-
})
|
|
10720
|
-
);
|
|
10721
10755
|
var delayForStreak = (streak) => streak < NO_PROGRESS_TURNS ? 0 : Math.min(
|
|
10722
10756
|
NO_PROGRESS_DELAY_MINUTES * 2 ** (streak - NO_PROGRESS_TURNS),
|
|
10723
10757
|
NO_PROGRESS_DELAY_CAP_MINUTES
|
|
10724
10758
|
);
|
|
10725
|
-
function createDeliveryPacing(progress, waitingOnSomeone2) {
|
|
10726
|
-
const clocks = /* @__PURE__ */ new Map();
|
|
10727
|
-
const observe = async (event) => {
|
|
10728
|
-
if (event.type !== "thread.session-set") return;
|
|
10729
|
-
const decoded = decodeSession(event.payload);
|
|
10730
|
-
if (isNone2(decoded) || decoded.value.session === null) return;
|
|
10731
|
-
const { threadId } = decoded.value;
|
|
10732
|
-
const activeTurnId = decoded.value.session.activeTurnId;
|
|
10733
|
-
const at = Date.parse(event.occurredAt);
|
|
10734
|
-
if (Number.isNaN(at)) return;
|
|
10735
|
-
const clock = clocks.get(threadId);
|
|
10736
|
-
if (activeTurnId !== null) {
|
|
10737
|
-
if (clock?.turnId !== activeTurnId)
|
|
10738
|
-
clocks.set(threadId, {
|
|
10739
|
-
turnId: activeTurnId,
|
|
10740
|
-
startedAt: at,
|
|
10741
|
-
streak: clock?.streak ?? 0,
|
|
10742
|
-
lastEndedAt: clock?.lastEndedAt ?? 0
|
|
10743
|
-
});
|
|
10744
|
-
return;
|
|
10745
|
-
}
|
|
10746
|
-
if (clock === void 0 || clock.turnId === null) return;
|
|
10747
|
-
const waiting = await waitingOnSomeone2(threadId).catch(() => true);
|
|
10748
|
-
const progressedAt = (await progress.get())[threadId];
|
|
10749
|
-
const progressed = progressedAt !== void 0 && progressedAt > clock.startedAt;
|
|
10750
|
-
clocks.set(threadId, {
|
|
10751
|
-
turnId: null,
|
|
10752
|
-
startedAt: clock.startedAt,
|
|
10753
|
-
streak: waiting ? clock.streak : progressed ? 0 : clock.streak + 1,
|
|
10754
|
-
lastEndedAt: at
|
|
10755
|
-
});
|
|
10756
|
-
};
|
|
10759
|
+
function createDeliveryPacing(progress, waitingOnSomeone2, counts) {
|
|
10757
10760
|
const allows = async (threadId, now3) => {
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
return
|
|
10761
|
+
if (await waitingOnSomeone2(threadId).catch(() => true)) return true;
|
|
10762
|
+
const [loops, changed] = await Promise.all([counts.list({ threadId }), progress.get()]);
|
|
10763
|
+
return loops.every((loop) => {
|
|
10764
|
+
const at = Date.parse(loop.updatedAt);
|
|
10765
|
+
const baseline = changed.baselines[threadId]?.[pairKey(loop.threadId, loop.peerThreadId)] ?? 0;
|
|
10766
|
+
return now3 >= at + delayForStreak(Math.floor(Math.max(0, loop.halfTrips - baseline) / 2)) * 6e4;
|
|
10767
|
+
});
|
|
10761
10768
|
};
|
|
10762
|
-
return {
|
|
10769
|
+
return { allows };
|
|
10763
10770
|
}
|
|
10764
10771
|
|
|
10765
10772
|
// src/runtime/goalScopes.ts
|
|
@@ -11165,13 +11172,9 @@ var JOINING = "the member is joining this team; its team session opens within a
|
|
|
11165
11172
|
function registerDispatchGate(ctx, deps) {
|
|
11166
11173
|
const pacing = createDeliveryPacing(
|
|
11167
11174
|
ctx.derivedState(deliveryPacingStateDefinition),
|
|
11168
|
-
async (threadId) => waitingOnSomeone(await readMemberExecution(ctx, threadId))
|
|
11175
|
+
async (threadId) => waitingOnSomeone(await readMemberExecution(ctx, threadId)),
|
|
11176
|
+
ctx.communication.wakeLoops
|
|
11169
11177
|
);
|
|
11170
|
-
ctx.reactor({
|
|
11171
|
-
name: "team-delivery-pacing",
|
|
11172
|
-
events: ["thread.session-set"],
|
|
11173
|
-
handle: (event) => pacing.observe(event)
|
|
11174
|
-
});
|
|
11175
11178
|
const legacyProjectGoal = async (project2, input) => {
|
|
11176
11179
|
if (project2.goalId === void 0) return allow;
|
|
11177
11180
|
if (readFact(project2.bindings ?? {}, input.memberId) !== null)
|
|
@@ -11692,7 +11695,7 @@ var decodeRequested = decodeUnknownOption2(
|
|
|
11692
11695
|
})
|
|
11693
11696
|
})
|
|
11694
11697
|
);
|
|
11695
|
-
var
|
|
11698
|
+
var decodeSession = decodeUnknownOption2(
|
|
11696
11699
|
Struct({
|
|
11697
11700
|
threadId: String4,
|
|
11698
11701
|
session: Struct({
|
|
@@ -11824,7 +11827,7 @@ function foldRecovery(state, event, previous) {
|
|
|
11824
11827
|
}
|
|
11825
11828
|
}
|
|
11826
11829
|
if (event.type === "thread.session-set") {
|
|
11827
|
-
const decoded =
|
|
11830
|
+
const decoded = decodeSession(event.payload);
|
|
11828
11831
|
if (isNone2(decoded)) return state;
|
|
11829
11832
|
const { threadId, session } = decoded.value;
|
|
11830
11833
|
for (const [projectId, project2] of Object.entries(state)) {
|
|
@@ -16532,7 +16535,7 @@ var CONCURRENCY = 2;
|
|
|
16532
16535
|
var TICK_MS2 = 15e3;
|
|
16533
16536
|
var decodeRetry = decodeUnknownOption2(RetryTrialInput);
|
|
16534
16537
|
var decodeSkip = decodeUnknownOption2(SkipTrialInput);
|
|
16535
|
-
var
|
|
16538
|
+
var decodeSession2 = decodeUnknownOption2(
|
|
16536
16539
|
Struct({
|
|
16537
16540
|
threadId: String4,
|
|
16538
16541
|
session: Struct({
|
|
@@ -16707,7 +16710,7 @@ function startTrialRuntime(ctx, deps, options = {}) {
|
|
|
16707
16710
|
};
|
|
16708
16711
|
const flush = () => serial(execute);
|
|
16709
16712
|
const failOnSessionError = (event) => serial(async () => {
|
|
16710
|
-
const decoded =
|
|
16713
|
+
const decoded = decodeSession2(event.payload);
|
|
16711
16714
|
if (isNone2(decoded) || decoded.value.session.status !== "error") return;
|
|
16712
16715
|
const { threadId, session } = decoded.value;
|
|
16713
16716
|
const record2 = runningTrials(await state.get()).find((row) => row.threadId === threadId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/plugin-team",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4256",
|
|
4
4
|
"description": "A project team roster with members, a lead, and goals.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"teams",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"tailwindcss": "^4.0.0",
|
|
35
35
|
"typescript": "~6.0.3",
|
|
36
36
|
"vite-plus": "0.2.2",
|
|
37
|
-
"ycodium-
|
|
38
|
-
"
|
|
37
|
+
"@ycodium-ai/plugin-api": "0.2.4256",
|
|
38
|
+
"ycodium-system-text": "0.0.0"
|
|
39
39
|
},
|
|
40
40
|
"ycodium": {
|
|
41
41
|
"plugin": "./dist/index.js",
|